Need help with DialogBox...
Today i tried to use the Dialog-Box-Object to create a nice Dialog-Box for an Options-Dialog for my App. Everything worked very fine and i was very happy with the look of the Options-Dialog.
I tried to do the following without success. Perhaps i missed something important, but i don' t know why it doesn' t work. Anyway, heres what i tried to do:
I have a Tab-Control with two Tabs. Now on the first Tab i have two Radio-Buttons, one Editbox and one Button.
If the User clicks on RadioButton1 then the Edit-Box and the Button should be disabled (grayed out). If the User clicks on the RadioButton2 the the Editbox and the Button should be enabled. I was able to disable the Editbox and the Button, but was not able to Enable them Again by clicking on the RadioButton2.
Could someone please check if this is a mistake of mine or it is a Bug in the Dialog-Box-Object.
PS: I don' t know why i always encounter such strange "Bugs". Like the "Colour-Selector-Bug" i had recently (still not solved, sadly...)
Thanks to you all and
Greets from Switzerland
jahkri
Re: Need help with DialogBox...
If you need further Information about the coding i did then just reply. What i did is rather simple.
To disable the Editbox i coded this:
- Rdb1 (RadioButton1) is clicked then -> enable Edt1 (Editbox1), 0 (0 means disable the control)
To enable the Editbox again i coded this:
- Rdb2 (RadioButton1) is clicked then -> enable Edt1 (Editbox1), 1 (1 means enable the control)
I also tried to use the "is checked"-Condition for the RadioButtons instead of the "is clicked"-Condition, but with no success.
I realy don' t know what i could have overlooked. Could it be that is has to do with the fact that i' m using a Tab-Control? Do i have to specify the Tab in the Coding to access the controls properly?
Thanks again for everbody who could test this and reply with the results.
Greets from Switzerland
jahkri
Re: Need help with DialogBox...
I would double check all your names, and order events. One of the most common issues with this object is a misspelled control. :)
Re: Need help with DialogBox...
Another common issue is using a condition for a different type of control, for example using a Is Button Clicked condition instead of a Is Radion Button Clicked condition.
Re: Need help with DialogBox...
PS: if everything seems correct, could you post an example?
Re: Need help with DialogBox...
Thanks StephenL and Yves for the fast replies. I' m at work now and can not check it out. But tonight i will check everything again and if i' m not able to find a solution (based on your Tipps), i will post an example as mentioned by Yves.
Thanks again and
Greets from Switzerland
jahkri
Re: Need help with DialogBox...
Hello Everbody,
after some Testing tonight i found something that is realy interessting.
Before this Testing i was always opening the Dialog-Box as "modal". Action: Open Modal,
because i want the App not to be accessible as long as the Dialog-Box is opened.
Now i tried it with the normal "Open"-Action. And suddenly the Method i mentioned
in the second Post works.
But the Problem is still not solved because if i use the "Open Modal"-Command then i
can not get it to work as it should. And i would like the Dialog-Box to be in Modal-Mode.
Could it be that the Dialog-Box behaves different when opened in modal-mode? Did i overlook something?
Thanks again and
Greetings from Switzerland
jahkri
Re: Need help with DialogBox...
Oh my... i just hopefully didn' t find the solution to the Problem in the Manual:
Text from Manual: Open Modal - opens the dialog box in modal mode. In modal mode, the parent application is stopped. You can retrieve the control values after the user closes the dialog box. You can also check how the user closed the dialog box with the Dialog / Closed by xxx conditions. If you need to modify the values of the controls, you must do it before opening the dialog box.
When i first read that part of the Dialog-Box-Help, i thought the limitation to modify values of Controls has just to do with getting the Data that the User entered back to MMF or to predefine the "content" of certain controls (like Values or Strings). But it seems this limitation is also true when a Control inside the Dialog-Box tries to manipulate another control in the same Dialog-Box. Strangly, this works when the Dialog-Box is opened with the normal "Open"-Command.
I' m a little confused. Is it realy true that in modal-mode a control (in my case the Radio-Button) can NOT enable/disable another control in the same Dialog-Box? And if so, is there a workaround like open the Dialog-Box in normal mode and somehow "lock" the MMF-App so that the user can not access it as long as the Dialog-Box is opened?
I also thought about just using a "SubApp" instead of the Dialog-Box, but this seems to be the last option for me because the Dialog-Box-Object IS useful, but this limitation (if it is realy like that) is somewhat frustrating.
Thanks for all your Support and kind replies.
Greets from Switzerland
jahkri
Re: Need help with DialogBox...
Ah, you've run into one of the most annoying things about the DialogBox object. :eek:
When you use the "Open Modal" action, the event loop is completely paused. This means that anything after the action will not run until the dialog has closed (you can see this in action by putting "End Application" after the "Open Modal" action). As a result, testing for events such as button presses or checkbox changes only works with the standard "Open" action.
There is, however, a workaround I found for this using the Kernel Object (only for MMF2 Developer unfortunately). If you disable the main window and then use the dialog's standard open action, it will appear to be modal, yet the event loop will still run. You can then re-enable the window when the dialog has closed.
Hope that helps. :)
Re: Need help with DialogBox...
Hey Jaffob,
thank you very much for the fast and very informative reply. Its good to now that the "Open-Modal"-Command completly pauses the Event-loop. It seems to be described in the Manual but it seems like i missunderstood it. I thought that the "Dialog-Box" runs independently from the Main-App and is therefor able to "detect" events itself and do "Actions" by itself. But its clear now.
Fortunately i have MMF2-Developer and should be able to use the Kernel-Object to disable the Main-Window. Its good to know that the Kernel-Object can do this kind of tasks.
Thanks again Jaffob and all Other nice People who offered help and support.
Greets from Switzerland
jahkri
Re: Need help with DialogBox...
No problem, glad to help. :)