[futurebasic] Placing a new file's icon

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : May 2002 : Group Archive : Group : All Groups

From: lcs@...
Date: Mon, 6 May 2002 05:06:52 +0200 (MEST)

Hi All,

Here is something which I have working with the FBII
mini-runtime, but which fails with both the FB^3 and the FB2
standard runtimes:-

I want to create a file and place its icon in a certain 
position relative to the another preexisting icon.
Reasonable?

Simplified placement code valid for both std runtimes is:

''--- cut
DEFSTR LONG

DIM pBlock.128
DIM err%
DIM pbPtr&, MarysLocation&, JohnsOffset&
DIM M$, J$

pbPtr& = @pBlock

M$="Mary"  
'' This file definitely preexists alongside the appl
'' In fact for me "Mary" was the application itself
J$="John"  '' This file may not preexist
JohnsOffset& = &00100020 
'' want John a bit SE of Mary (16 down 32 right)

DEF BLOCKFILL(pbPtr&, 128, 0)
pbPtr&.ioNamePtr&  = @M$
err% = FN GETFILEINFO (pbPtr&)
MarysLocation& = pbPtr&.ioFlUsrWds.fdLocation&

OPEN"A",#1,J$  
CLOSE#1 

"--thePlacement"
DEF BLOCKFILL(pbPtr&, 128, 0)
pbPtr&.ioNamePtr& = @J$
err% = FN GETFILEINFO (pbPtr&)
pbPtr&.ioFlUsrWds.fdLocation& = MarysLocation& + JohnsOffset&
err% = FN SETFILEINFO (pbPtr&)
''--- cut

As I said, something similar works with Miniruntime.  However I
do call a bunch of toolbox FNs not available in the std runtime
since OPEN and CLOSE are just not available in the FB2
miniruntime. Beware also that with this simplified code, you
may have to close and open the window to see the true new icon
position of "John".

This code completely fails in the std runtimes precisely if the
file "John" was originally nonexistant.

In that case, I am guessing I will have to do some sort of
fancy Finder updating before "--thePlacement" in order to get
the wanted icon placement (with the std runtimes).

Suggestions?

Cheers

Laurent S.