mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Nov 2003
Posts: 25
N
NeoN Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Nov 2003
Posts: 25
Switching tabs from within the dialog init event doesn't work. Or, at least, I can't get it to work.

Is there anything wrong with this code? It should create a dialog with three tabs and start with the second tab on top, but it starts with the first on top...
Clicking on the second tab, doesn't do anything, so I guess it *has* switched to the second tab "internally", but visually it still shows the first. After clicking on tab 1 or 3, you can switch to tab 2 again.


Code:
alias tabtest {
  dialog -amr tabtest tabtest
}

alias tabswitch {
  did -fu tabtest $1
}

dialog tabtest {
  title "Tabtest"
  option dbu
  size -1 -1 150 130
  tab "tab1", 1, 5 5 140 100
  tab "tab2", 2
  tab "tab3", 3
  button "Close", 40, 30 110 40 13, ok
  button "tab1", 10, 20 30 40 13, tab 1
  button "tab2", 20, 20 30 40 13, tab 2
  button "tab3", 30, 20 30 40 13, tab 3
}

on *:DIALOG:tabtest:init:0: {
  ; should switch to tab 2
  tabswitch 2
}

Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
Confirmed, think this might have been mentioned before but can't find it.

Workaround incase you didn't know it:
Code:
on *:DIALOG:tabtest:init:0: {
  .timer 1 0 tabswitch 2
}

Joined: Nov 2003
Posts: 25
N
NeoN Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Nov 2003
Posts: 25
Quote:

Confirmed, think this might have been mentioned before but can't find it.


I couldn't find anything at first, but I searched some more, and it has indeed been posted before: click

Sorry for posting this again...

Joined: Dec 2002
Posts: 83
D
Babel fish
Offline
Babel fish
D
Joined: Dec 2002
Posts: 83
As explained in the help file, the init event is executed just before the opening of the dialog.
If you want to tag on a tab in the init event, use a timer as it :

timer -m 1 1 did -f $dname id_tab


Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
But you can do other things on init, e.g. checking radios, putting text in edits, adding lines to combos, etc.

Joined: Dec 2002
Posts: 83
D
Babel fish
Offline
Babel fish
D
Joined: Dec 2002
Posts: 83
that is the purpose of an init event. To prepare the settings of the dialog before displaying

Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
I am aware of that.

I can't see why you posted what you did, you seem to be suggesting it's the code's fault, when it isn't.

Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Exactly, you might want to display a certain tab.


New username: hixxy
Joined: Mar 2004
Posts: 33
M
Ameglian cow
Offline
Ameglian cow
M
Joined: Mar 2004
Posts: 33
you can use :
Code:
alias tabswitch {  did -c tabtest $1}

Joined: Nov 2003
Posts: 25
N
NeoN Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Nov 2003
Posts: 25
That makes no difference.


Link Copied to Clipboard