Hi, see the updated code in one of the replies below
What I need is an application with the main interface (which is shown on a non-modal dialog) that has a button "Update settings".
When this button is clicked, I need to load another non-modal dialog (when the main dialog still shown on the screen but not operable until this new dialog is closed).
The new dialog should show several edit boxes, let the user to update them and then click on one of two buttons: "Save settings" or "Cancel".
If the user clicks on 'Cancel", well, the new dialog is just closed and the user can work on the main interface dialog further.
But if he clicks on "Save settings", then I should check if all the values in the edit boxes in the new dialog are valid (for example, some of them have to be numeric), and if everything is ok, close that dialog and save settings to a file, but if something is wrong, I want just warn the user with the message that the data in the new dialog is wrong, and then let him change the data and then click again on "Save settings".
If I understand it right, it has to be two non-modal dialog boxes, right?
Because I don't understand how I'll give the user the same dialog with the data he just typed (if the data he typed is non-valid).
So I tried to write the program using your samples, bu tit doesn't work... Could you please help me with this?
This is my script:
Let>LabelSoOn=texts from the Web, and so on.
Let>AndThen=messages, and then
Let>LabelTake=If the end of the text is not defined, take
Dialog>Dialog1
Caption=Update Settings
Top=125
Width=496
Left=16
Height=405
Label=Take ,16,163
Label=%AndThen%,80,163
Label=%LabelSoOn%,304,163
Edit=LocalNum,47,159,26,1
Edit=WebNum,271,159,26,2
Edit=CharsNum,210,225,31,800
Button=Save changes,320,304,153,25,4
Button=Cancel,320,336,153,25,6
Label=Start with,16,196
Label=messages.,192,196
Label=%LabelTake%,16,229
Label=characters ,248,229
EndDialog>Dialog1
Dialog>Dialog2
Caption=Non-Modal Dialog
Top=113
Width=264
Left=16
Height=113
Button=Update,16,8,75,25,5
Button=Exit,16,48,75,25,6
Edit=msEdit1,104,8,121,Fred
ComboBox=msComboBox1,104,32,121,1%CRLF%2
Edit=msEdit2,104,56,121,
EndDialog>Dialog2
Show>Dialog1
Label>ActionLoop
GetDialogAction>Dialog1,r
if>r=4,Update
if>r=6,Close
if>r=2,exit
Goto>ActionLoop
Label>exit
SRT>Update
Show>Dialog2
Label>Action2Loop
GetDialogAction>Dialog2,r2
if>r2=5
MessageModal>To update: %Dialog2.msEdit2%
ResetDialogAction>Dialog2
Endif
if>r2=6
CloseDialog>Dialog2
Let>r2=2
Goto>thisexit
Endif
if>r2=2,thisexit
Goto>Action2Loop
Label>thisexit
Let>Dialog1.CharsNum=%Dialog1.LocalNum% %Dialog1.WebNum%
ResetDialogAction>Dialog1
END>Update
SRT>Close
CloseDialog>Dialog1
Let>r=2
END>Close
(I tried first just to show a value, to see if I can access values there.)
What am I doing wrong?
The matter is that this new dialog disappears and nothing is done as it should.
Please please help!
Thank you,
Olga.
Problem with dialogs - please help!!
Moderators: JRL, Dorian (MJT support)
Problem with dialogs - please help!!
Last edited by OlgaFB on Fri Jan 28, 2005 10:14 am, edited 1 time in total.
Hi,
Yes, it has to give user some data from the UpdateSettings dialog.
I just realized: the modal dialog, when it closes, still exists with the same data, right? So I may make it modal and just show it again if something is wrong? ALl the data user typed in before, will still be there? I'll try it.
And still, why doesn't it work? I think I did everything right...
Thank you,
Olga.
Yes, it has to give user some data from the UpdateSettings dialog.
I just realized: the modal dialog, when it closes, still exists with the same data, right? So I may make it modal and just show it again if something is wrong? ALl the data user typed in before, will still be there? I'll try it.
And still, why doesn't it work? I think I did everything right...
Thank you,
Olga.
I tried now with a modal dialog.
The problem is that when the second dialog is opened and then closed, r never seems to be updated. I mean, GetDialogAction doesn't work, and no clicked button sends any signals to the program. What should I do?
Here is the complete code:
Let>LabelSoOn=texts from group 2, and so on.
Let>AndThen=texts from group 1, and then
Let>LabelTake=If the end of the text is not defined, take
Dialog>Dialog1
Caption=Update File Settings
Top=125
Width=496
Left=16
Height=405
Label=File Name:,16,12
Label=File URL:,16,44
Label=Directory on your PC with this file data:,16,112
Label=FileDir,16,128
Label=Take ,16,163
Label=%AndThen%,80,163
Label=%LabelSoOn%,304,163
Label=File2 URL:,16,76
Edit=msFileName,72,8,401,
Edit=FileURL,72,40,401,
Edit=LocalNum,47,159,26,1
Edit=WebNum,271,159,26,2
Edit=File2URL,72,72,401,
ComboBox=StartWith,72,192,113,group1%CRLF%group2
Edit=CharsNum,210,225,31,800
Button=Save changes,320,304,153,25,4
Button=Cancel,320,336,153,25,6
Button=Update group settings,320,264,153,25,8
Label=Start with,16,196
Label=files.,192,196
Label=%LabelTake%,16,229
Label=characters from each file to merge.,248,229
EndDialog>Dialog1
Dialog>Dialog2
Caption=Non-Modal Dialog
Top=113
Width=264
Left=16
Height=113
Button=Update,16,8,75,25,5
Button=Exit,16,48,75,25,6
Edit=msEdit1,104,8,121,Fred
ComboBox=msComboBox1,104,32,121,1%CRLF%2
Edit=msEdit2,104,56,121,
EndDialog>Dialog2
Show>Dialog1
Label>ActionLoop
GetDialogAction>Dialog1,r
Let>Dialog1.WebNum=r: %r%
if>r=8,Update
if>r=6,Close
if>r=2,exit
Goto>ActionLoop
Label>exit
SRT>Update
Label>Action2Loop
Show>Dialog2,r2
' GetDialogAction>Dialog2,r2
if>r2=5
MessageModal>To update: %Dialog2.msEdit1%
' ResetDialogAction>Dialog2
Let>r2=8
Endif
if>r2=6
' CloseDialog>Dialog2
Let>r2=2
Goto>thisexit
Endif
if>r2=2,thisexit
Goto>Action2Loop
Label>thisexit
Let>Dialog1.LocalNum=%Dialog2.msEdit1% %Dialog2.msComboBox1%
'Let>r=0
ResetDialogAction>Dialog1
END>Update
SRT>Close
MessageModal>"close"
CloseDialog>Dialog1
Let>r=2
END>Close
Please help!
Thank you,
Olga.
The problem is that when the second dialog is opened and then closed, r never seems to be updated. I mean, GetDialogAction doesn't work, and no clicked button sends any signals to the program. What should I do?
Here is the complete code:
Let>LabelSoOn=texts from group 2, and so on.
Let>AndThen=texts from group 1, and then
Let>LabelTake=If the end of the text is not defined, take
Dialog>Dialog1
Caption=Update File Settings
Top=125
Width=496
Left=16
Height=405
Label=File Name:,16,12
Label=File URL:,16,44
Label=Directory on your PC with this file data:,16,112
Label=FileDir,16,128
Label=Take ,16,163
Label=%AndThen%,80,163
Label=%LabelSoOn%,304,163
Label=File2 URL:,16,76
Edit=msFileName,72,8,401,
Edit=FileURL,72,40,401,
Edit=LocalNum,47,159,26,1
Edit=WebNum,271,159,26,2
Edit=File2URL,72,72,401,
ComboBox=StartWith,72,192,113,group1%CRLF%group2
Edit=CharsNum,210,225,31,800
Button=Save changes,320,304,153,25,4
Button=Cancel,320,336,153,25,6
Button=Update group settings,320,264,153,25,8
Label=Start with,16,196
Label=files.,192,196
Label=%LabelTake%,16,229
Label=characters from each file to merge.,248,229
EndDialog>Dialog1
Dialog>Dialog2
Caption=Non-Modal Dialog
Top=113
Width=264
Left=16
Height=113
Button=Update,16,8,75,25,5
Button=Exit,16,48,75,25,6
Edit=msEdit1,104,8,121,Fred
ComboBox=msComboBox1,104,32,121,1%CRLF%2
Edit=msEdit2,104,56,121,
EndDialog>Dialog2
Show>Dialog1
Label>ActionLoop
GetDialogAction>Dialog1,r
Let>Dialog1.WebNum=r: %r%
if>r=8,Update
if>r=6,Close
if>r=2,exit
Goto>ActionLoop
Label>exit
SRT>Update
Label>Action2Loop
Show>Dialog2,r2
' GetDialogAction>Dialog2,r2
if>r2=5
MessageModal>To update: %Dialog2.msEdit1%
' ResetDialogAction>Dialog2
Let>r2=8
Endif
if>r2=6
' CloseDialog>Dialog2
Let>r2=2
Goto>thisexit
Endif
if>r2=2,thisexit
Goto>Action2Loop
Label>thisexit
Let>Dialog1.LocalNum=%Dialog2.msEdit1% %Dialog2.msComboBox1%
'Let>r=0
ResetDialogAction>Dialog1
END>Update
SRT>Close
MessageModal>"close"
CloseDialog>Dialog1
Let>r=2
END>Close
Please help!
Thank you,
Olga.
According to your script Dialog2 is being shown modal, and GetDialogAction is commented out. So in your pasted code it does nothing anyway.
Have you stepped through this code with the debugger?
Have you stepped through this code with the debugger?
MJT Net Support
[email protected]
[email protected]
I said in the beginning of the latest reply that I tried now to make this dialog modal, so of course GetDialogAction for it is commented out.support wrote:According to your script Dialog2 is being shown modal, and GetDialogAction is commented out. So in your pasted code it does nothing anyway.
what I meant when I said, "GetDialogAction doesn't work", I meant the first dialog's GetDialogAction.
What's happening is when I run this program, the first dialog shows, and everything works in it great, it responses to all the buttons, etc. When then an 'Update group settings' button is clicked, the second dialog shows. When I click there 'Update', then strange things start happening, and the first dialog never reacts any more to any button.
No, I'm not quite good with the debugger. Could you please just run the script as it is on your computer and see exactly what I'm talking about?support wrote:Have you stepped through this code with the debugger?
Thank you,
Olga.
Hi,
Having looked at this closely we have identified a bug with nested dialogs. The solution is straightforward and Olga is now checking the fix. Assuming all is well we will release the bug fix straight away.
Having looked at this closely we have identified a bug with nested dialogs. The solution is straightforward and Olga is now checking the fix. Assuming all is well we will release the bug fix straight away.
MJT Net Support
[email protected]
[email protected]