|
xhine
|
xhine
|
I create a dialog using , but when I click the ok button, which I've labeled as result, nothing is returned. button "Yes", 2, 70 100 70 25, result ok that's basically the line in the dialog {} section. I expect it to return "Yes" but I'm guessing there is something I'm missing?
|
|
|
|
Joined: Aug 2004
Posts: 7,168
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,168 |
on *:dialog:<dialog_name>:close:*:{
echo -a $did($dialog(<dialog_name>).result)
}
That should echo the word Yes in the active window when you press the button I didn't know what you were wanting to do with that information, so I just echoed it.
|
|
|
|
xhine
|
xhine
|
That does work, but I am trying to get the result in a different dialog. So when someone, for example, clicks the "add" button in dialog 1, it will create dialog 2 (which asks for certain info), and return the info. That is what I'm trying to accomplish.
|
|
|
|
Joined: Feb 2005
Posts: 342
Fjord artisan
|
Fjord artisan
Joined: Feb 2005
Posts: 342 |
Sorry, but the function "return" can only return ONE string. If you are calling another dialog to input information into it, and want that information to go into the other dialog, you simply do something like on *:dialog:d2:sclick:200:{
did -a d1 <ID> $did(d2,ID2)
did -a d1 <ID> $did(d2,ID2)
}
|
|
|
|
xhine
|
xhine
|
Err, not exactly what I had in mind. Let me try to be more specific. When the user presses the "add" button on dialog 1, that dialog will create another dialog (a dialog to request input) and that 2nd dialog (that was created by dialog 1) will return back the input of the user. So, something like:
if ($dialog(userinput,userinput,-4) == Yes) { etc.. }
Does that make more sense ?
|
|
|
|
Joined: Jan 2003
Posts: 2,973
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,973 |
mIC doesn't work in the way other languages do. It can't call a dialog and hold processing for the return result. You need to use what Russel or Rand suggested. When th second dialog closes, return the information in the "on close event". I tend to make sure the dialog is open first. For example:
on *:DIALOG:[color:blue]info_dialog[/color]:close:*: {
if ($dialog([color:blue]main_dialog[/color])) {
/did -a [color:blue]main_dialog[/color] 100 blah blah
}
}
|
|
|
|
Joined: Mar 2005
Posts: 420
Fjord artisan
|
Fjord artisan
Joined: Mar 2005
Posts: 420 |
You can also use $input alias testinput {
var %uc = $input(Press Yes or No?,uy, Blah blah)
if ( $! ) {
;do stuff here if Yes
}
else {
; do stuff here if No
}
}
on *:dialog:d1:sclick:200: .timer 1 0 testinput The above alias will give you an input dialog with Yes or No button. If you want to enter an information, add "e" to "uy".
|
|
|
|
Joined: Oct 2005
Posts: 1,671
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,671 |
Try this code:
alias myDialog { dialog -mv Dialog1 Dialog1 }
;
dialog Dialog1 {
title "Dialog1"
option dbu
size -1 -1 50 50
button "Yes/No", 100, 5 5 40 40
}
on *:DIALOG:Dialog1:sclick:100:{ echo -a Result is: $dialog(Dialog2,Dialog2,-4) }
;
dialog Dialog2 {
title "Dialog2"
option dbu
size -1 -1 75 40
[color:red]text "", 10, 0 0 10 15,result hide
button "ok", 500, 0 0 1 1,hide ok[/color]
[color:green]button "No", [color:blue]1000[/color], 5 5 30 30
button "Yes", [color:blue]1001[/color], 40 5 30 30[/color]
}
on *:DIALOG:Dialog2:sclick:[color:blue]1000,1001[/color]:{
[color:red]did -ra Dialog2 10 $did($did).text
dialog -k Dialog2[/color]
}
I don't know why you can't return the results of a button, but this code should work for you. The green text is the buttons that you can change/add/remove. The blue are the dialog IDs that will cause a "result" when clicked. The red portions are the workaround. -genius_at_work
|
|
|
|
|