mIRC Homepage
Posted By: Nanaki Multiple default buttons in custom dialogs - 05/04/04 12:52 PM
I have a tabbed dialog, and each tab has a button that I would like to make the default button within that tab (so when enter is pressed the event relating to that button would occur). However, it seems it is only possible to have one default button for the whole dialog, and not a default button on each tab. Could you please either tell me that it is definitely not possible, so I stop trying, or perhaps detail a way that it is possible?

Thanks in advance-

~Nanaki.
Not sure if this will work, but what I'd try is

on *:dialog:sclick:*:*: {
if ($did == id-of-tab) did -f $dname id-of-button
}
Following Loc's idea...

dialog x {
size -1 -1 52 35
option dbu
tab "A", 1, 1 0 48 32
button "one", 3, 5 16 40 12, default tab 1
tab "B", 2
button "two", 4, 5 16 40 12, tab 2
}

On *:dialog:x:sclick:*:{
if $did == 1 { did -t x 3 }
elseif $did == 2 { did -t x 4 }
elseif $did == 3 || $did == 4 {
echo -a * Clicked button: $did
}
}
Re: Loc's idea:
Well, it focuses on the button, but then if I type something into the edit box, I lose focus from the button - I want to be able to hit enter and for it to react, which it doesn't.
And also, it is on *:dialog:*:sclick:*:, rather than what you had given which was on *:dialog:sclick:*:*:
Thanks anyway.
Posted By: MIMP Re: Multiple default buttons in custom dialogs - 05/04/04 01:51 PM
The /did -t switch is suppose to set default. I think that's what Loc was after. Give that a try. From the help file:


The /did command
The /did command allows you to modify the values of controls in a dialog, eg. changing the text in an edit control, or setting focus to a button, or deleting lines in a listbox.

/did -ftebvhnmcukradiogj name id [n] [text | filename]

-f set focus on id
-t set id as default button

Ah yes, thankyou Online and MIMP, it works great. I did see that in the help file, but couldn't quite get it to work, perhaps I was using the wrong syntax. Anyway, works now, thanks again!
© mIRC Discussion Forums