Custom Modal List Dialog Methodology

Mark Schonewille europe at ehug.info
Sun Jun 26 15:20:25 EDT 2005


Stephen,

Modal dialog windows prevent scripts that are not in the modal
stack from continuing to execute. That is why I usually put a
function like yours into the modal stack itself. The function
may open the stack and wait with messages until there is no
window <short name of the modal stack>, before returning the
dialogdata.

Most of the time, I don't use a function for that. I send a
message to the dialog window to open itself. The script from
where I send that message will halt until the window has
disappeared. In the OK button, I include a separate script to
set the dialogData. In this way, you don't need to wait with
messages. Once the dialog has closed, the script from where the
message to open it was sent, will continue and can read out the
dialogData.

Best regards,

Mark


Stephen Barncard wrote:
> I'm currently recreating in REV what I used to use a Rinaldi XCMD for... 
> namely a listbox dialog for choosing items from a list.
> 
> The idea is to have a function
> 
> 
> function listbox pPromptData,pListData
> 
> that puts up a window with a prompt field, and a list field. Select and 
> click an item or hit return or enter. Standard GUI stuff.
> 
> This would return the selected item or empty.
> 
> 
> I've created the new window/stack, I'm using dialogData to pass the info 
> back and forth, and I have the function that sets up the data and opens 
> the window. I had figured on using wait with messages to halt script 
> execution until the dialog was closed, but I can't seem to send the 
> right message to it from the dialog closing to get it to go to the next 
> line of code, 'BEEP'. I also tried changing a variable. Anyone found the 
> best way to deal with this?
> 
> Eventually I'd like to be able do it all from a script on the fly - 
> create the window,fields, buttons, everything, from a text description 
> before display like I used to do in WindowScript... it's all about 
> properties, after all....
> 
> thanks...
> 
> --this is located in the stack script of the calling stack
> --scrunch converts returns to VTs to get more data in dialogdata
> 
> function dialogList pPrompt,pListData
>   global gDialogFlag
>   if there is a stack "listDialog"
>   then
>     put scrunch(pPrompt) & return & scrunch(pListData) into tDialogTxt
>     set the dialogData to tDialogTxt
>     --- put the dialogData
>     -- exit to top
>     put "true" into gDialogFlag
>     open stack "listDialog"   <------ this is the dialog
>     wait with messages
>     -- wait until gDialogFlag is "false" with messages??
>     beep        <--------this never executes
>      else
>     answer "Can't find stack: listDialog"
>     exit to top
>   end if
>   return the dialogData
> end dialogList

-- 

eHUG coordinator
mailto:europe at ehug.info
http://www.ehug.info
http://home.wanadoo.nl/mark.sch
http://www.economy-x-talk.com

Please inform me about vacancies in the field of
general economics at your institute. I am also looking
for new freelance programming projects.






More information about the use-livecode mailing list