View previous topic :: View next topic |
Author |
Message |
jwfv Valued Contributor
Joined: 19 Mar 2002 Posts: 422 Location: Beaufort, SC
|
Posted: Wed Jun 01, 2005 7:49 pm Post subject: Dialog Select |
|
|
I know that I have seen this discussion before, but I couldn't find it and couldn't remember what was said.
I have problems still with tracking the various dialogs my programs create. I have parsed the events that they produce and then have assigned those numbers to variables:
Code: | wait event
%I = @event(D)
parse "%I;%%introdialog", %I |
I quickly use up lots of variables, so it isn't ideal. Also, some events (like timers) don't produce the active dialog number. Is it possible to include in VDS the ability to use a class name to select dialog, like selecting a window?
For instance:
Code: | Dialog Select, #introdialog |
Anyway, just really wanted to get it boosted back up on the wish list. _________________ Joe Floyd |
|
Back to top |
|
|
trapper Contributor
Joined: 28 Jan 2005 Posts: 112 Location: Brisbane, Australia
|
Posted: Wed Jun 01, 2005 10:26 pm Post subject: |
|
|
I wrote a small function sometime ago which really serves me well.....
Code: | #DEFINE COMMAND, DialogID
#DEFINE FUNCTION, DialogID
:DialogID
if @equal(%1,Add)
list add, %%WinList, %2
elsif @equal(%1,Delete)
list seek, %%WinList, 0
%R = @match(%%WinList,%2)
list delete, %%WinList
elsif @numeric(%1)
%R = @item(%%WinList,%1)
else
list seek, %%WinList, 0
%R = @match(%%WinList,%1)
%R = @index(%%WinList)
end
exit %R
|
I use it in conjunction with the following Event loop:
Code: | :Evloop
wait event,0.1
parse "%E;%D", @event(D)
if @zero(%D)
dialog select, 0
goto %E
else
dialog select, %D
goto @DialogID(%D)_%E
end
|
At the beginning of my programs I declare and create the list %%WinList.
As soon as I DIALOG SHOW the main dialog I issue the command:
Code: | DialogID Add, <MainDialogName> |
.. so it will be in index position 0 in the list which of course corresponds to its position in the internal list maintained by VDS.
From then on as I SHOW and CLOSE child dialogs I follow with these commands as appropriate:
Code: | DialogID Add, <ChildDlgName>
DialogID Delete, <ChildDlgName> |
.. and this will keep the list properly updated.
If I want to know the ID of a particular child dialog I use the function:
Code: | @DialogID(<ChildDlgName>) |
If I have a child dialog's ID from @event() and want to pass control to the correct event I can use the DialogID function in a Goto call as follows:
Code: | goto @DialogID(%D)_EventName |
(Child Dialog events are named ChildDlgName_EventName)
This is all working very well here and has eliminated any problems I used to have controlling multiple dialogs.
Cheers. _________________ John Trappett |
|
Back to top |
|
|
jwfv Valued Contributor
Joined: 19 Mar 2002 Posts: 422 Location: Beaufort, SC
|
Posted: Thu Jun 02, 2005 12:40 am Post subject: |
|
|
Thanks - looks like a good system. For my current project it would take quite a bit of retro-engineering. But for future programs, I would consider implementing something like that.
Sure would be nice if it were built into VDS though ... _________________ Joe Floyd |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|