|
Joined: Mar 2003
Posts: 27
Ameglian cow
|
OP
Ameglian cow
Joined: Mar 2003
Posts: 27 |
dialog pickachan {
title "Pick a channel"
size -1 -1 115 70
option dbu
edit "", 1, 1 47 113 10, autohs %channel
button "NRK1", 2, 1 1 37 12
button "NRK2", 3, 1 14 37 12
button "NRK3", 4, 1 27 37 12
button "TV2", 5, 39 1 37 12
button "TV2 Zebra", 6, 39 14 37 12
button "TVNORGE", 7, 77 27 37 12
button "TV3", 8, 77 1 37 12
button "FEM", 9, 77 14 37 12
button "TV2 Film", 10, 39 27 37 12
text "Custom:", 11, 1 39 25 8
button "Cancel", 13, 58 58 56 12, cancel
button "Ok", 12, 1 58 56 12, ok
}
on *:dialog:pickachan:sclick:*:{
if ($did == 2) { set %channel NRK1 }
if ($did == 3) { set %channel NRK2 }
if ($did == 4) { set %channel NRK3 }
if ($did == 5) { set %channel TV2 }
if ($did == 6) { set %channel TV2 Zebra }
if ($did == 7) { set %channel TVNORGE }
if ($did == 8) { set %channel TV3 }
if ($did == 9) { set %channel FEM }
if ($did == 10) { set %channel TV2 Film }
if ($did == 13) { halt }
dialog -x pickachan
}
This is a part of a bigger script, where this part is called up using "$dialog(pickachan,pickachan,-3)" But when i click one of the buttons, the variable is not saved, the only thing that works is if i write a custom one. The problem is proberly something around the "dialog -x pickachan" Any help is appreciated
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
That is because you're telling it to save to that variable whatever is in the edit box when the dialog is closed. In other words, $null if you don't manually enter something there. So you're setting it with the button's value, then setting it with $null when the dialog is closed.
You can either make pressing the buttons insert text into the edit box and just set the variable from there (not setting it when the buttons are pressed), or remove the variable setting from the edit line and instead include a button for "set" that has to be pressed after adding text to the edit line. There are other methods as well... it's up to you how you want to handle it. You just can't do both things the way you have it right now.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Mar 2003
Posts: 27
Ameglian cow
|
OP
Ameglian cow
Joined: Mar 2003
Posts: 27 |
Ok, tnx for the tips Made this one, but it sends me the previous result that i typed in..
dialog new_table {
title "New Project"
size -1 -1 108 94
option dbu
button "nrk1", 1, 9 6 37 12
edit "", 2, 12 59 50 10, autohs %2
text "Text Label", 3, 12 46 25 8
button "set", 4, 66 59 37 12
button "ok", 5, 8 78 37 12, ok
button "cancel", 6, 48 78 37 12, cancel
}
on *:dialog:new_table:sclick:*:{
if ($did == 1) { set %channel NRK1 }
if ($did == 4) { set %channel %2 }
if ($did == 6) { halt }
dialog -x new_table
//msg $me %channel
}
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
The dialog -x command closes the dialog without executing any commands, this (I believe) includes the setting of %2 from your edit box. Try dialog new_table {
title "New Project"
size -1 -1 108 94
option dbu
button "nrk1", 1, 9 6 37 12
edit "", 2, 12 59 50 10, autohs
text "Text Label", 3, 12 46 25 8
button "set", 4, 66 59 37 12
button "ok", 5, 8 78 37 12, ok
button "cancel", 6, 48 78 37 12, cancel
}
on *:dialog:new_table:sclick:1-4:{
set %channel $did($did)
dialog -k new_table
.msg $me %channel
}
|
|
|
|
|