How to use customProperties

Klaus Major klaus at major-k.de
Tue Feb 28 09:44:14 CST 2006


Hi Reinhold,

> Hi!
>
> I created a small substack to use it as a modal dialog.
> In the MetaTalk Reference I found this:
> ...
> - - - - - - -
>
> To realise this I manually created two "New Property..." in "Custom  
> Props..." of "Stack Properties".
> I called them ImgCollectorProp and ImgImportProp.
> Than I wrote this script in the corresponding button in the mainstack:
>
>     set the ImgCollectorProp of me to ImportImage
>     set the ImgImportProp of me to ImageCollector
>     modal stack "ImageTypSelector"
> Than I put the following script into the stackscript of the  
> substack and into the cardscript:
>
> on openCard  #on preopenStack
>   get the ImgImportProp of stack "Karten"
>   put it into fld "Imgname"
>   get the ImgCollectorProp of stack "Karten"
>   put it into fld "ImgList"
> end openCard  # end preopenStack
> - - - - - - -
> The modal stack arise as wanted, but the fields "Imgname" and  
> "ImgList" keep empty.
> You may smile, but that's my first trial with customProperty

well, you are quite close! :-)

This is form the button script, right?
Lets call it Button "bildbutton"

...
    set the ImgCollectorProp of me to ImportImage
    ## ME  = button "bildbutton" in this case!

    set the ImgImportProp of me to ImageCollector
    ## Correct so far, but now that are the buttons custom properties!

     modal stack "ImageTypSelector"
...

So you have to query these custom properties like this:

on preopenStack
   get the ImgImportProp OF BTN "bildbutton" OF CD X of stack "Karten"
   put it into fld "Imgname"
   get the ImgCollectorProp OF BTN "bildbutton" OF CD X of stack  
"Karten"
   put it into fld "ImgList"
end preopenStack

that will do the trick :-)


OR, if you want to use the custom properties of that stack:

...
    set the ImgCollectorProp of stack "Karten" to ImportImage
     set the ImgImportProp of stack "Karten" to ImageCollector
     modal stack "ImageTypSelector"
...

then your "preopenstack" script above will work.

> :-)
> Reinhold

Regards

Klaus Major
klaus at major-k.de
http://www.major-k.de



More information about the metacard mailing list