Hi everybody,
I try to join two pieces of data pointed by handles with a separator in
between, following is the piece of code that attempts to do it
'=========================================
CLEAR LOCAL FN accrocherub(r1,r2)
DIM 3 sep$
DIM OSErr
DIM HandleRub1&,HandleRub2&,strHndl&
LONG IF r1>0 AND r2>0 'just in case of invalid params
HandleRub1&=glafiche.RubHndl&(r1) 'get first locked data handle
HandleRub2&=glafiche.RubHndl&(r2) 'get second locked data handle
'test first param and if there is something to add
LONG IF r1=1 AND FN GETHANDLESIZE(HandleRub2&)>1
strHndl&=FN NEWHANDLE(3) 'ask for a tiny handle
LONG IF strHndl& AND FN HLOCK(strHndl&)=_noerr
sep$=" - " 'separator string
BLOCKMOVE @sep$+1,[strHndl&],3 'fill newly created handle
OSErr= FN HANDANDHAND(strHndl&,HandleRub1&)'add it to first
data handle
OSErr=FN HUNLOCK(strHndl&)
DEF DISPOSEH(strHndl&) 'get rid of the tiny handle
END IF
END IF
'now try to add the second data handle to the first one
OSErr= FN HANDANDHAND(HandleRub2&,HandleRub1&)
END IF
END FN
'=========================================
The problem is that FN HANDANDHAND seems to work ok if it is called only
once.
I mean that when I can add the string separator I cannot add the second
data handle
and if I don't need to add a string separtor the second data handle is
correctly added to the first.
Can someone tell me what's going wrong here ?
How can I fix this or is there an easiest way to do the same thing ?
Another question, I dimmed a record in my global file like the one below
:
DIM RECORD rubrique
DIM RubHndl&
DIM coupuretiret%
DIM retourchariot%
DIM abreviation%
DIM 50 tagdebut$
DIM 50 tagfin$
DIM END RECORD.rubrique
then an array of records
DIM glafiche.rubrique(_nbRubriques)
I stored the original values in a custom resource (my app will load it
when it fires up), but right now, I would like to know if it’s possible
to build a TMPL resource so that I could edit easily in ResEdit the two
last fields that hold strings. My trials failed until now.
Optionnaly, what does LOL mean ?
Thanks in advance
Alain