mIRC Home    About    Download    Register    News    Help

Print Thread
#192205 24/12/07 05:31 PM
Joined: Mar 2007
Posts: 139
S
Solo1 Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Mar 2007
Posts: 139
Greetings

Is there anyway to make a tabbed dialog window and i could put separate text into each tabbed window? if this can be done, and anyone has the time to show me a quick crude example it would be very much appreciated.

Kind regards and Merry Christmas to all.

Joined: Dec 2007
Posts: 61
P
PO3 Offline
Babel fish
Offline
Babel fish
P
Joined: Dec 2007
Posts: 61
you mean something like this ?


Code:
dialog new_table {
  title "New Project"
  size -1 -1 144 136
  option dbu
  tab "Tab 1", 1, 2 0 134 135
  text "Put Your Text here for tab1", 8, 8 24 121 96, tab 1
  tab "Tab 2", 2
  text "Put Your Text here for tab2", 9, 8 24 121 104, tab 2
  tab "Tab 3", 3
  text "Put Your Text here for tab3", 10, 8 24 121 104, tab 3
  tab "Tab 4", 4
  text "Put Your Text here for tab4", 11, 8 24 121 104, tab 4
  tab "Tab 5", 5
  text "Put Your Text here for tab5", 12, 8 24 121 88, tab 5
}

Joined: Mar 2007
Posts: 139
S
Solo1 Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Mar 2007
Posts: 139
Hi PO3

that is pretty much what i meant and a very neat little dialog, but i would like the option to add text on an event using the /did which i can do but it has to be like a window where i can add lines and scroll up and down the window to view previous lines.

Also i would like to open a new tab for each network i connect to, not a default five tabs.

Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
You cannot dynamically add tabs or any controls after the dialog has been created afaik. You'll need to use a more customized module like mdx or the like.

As a warning, I personally don't know anything about MDX, and would suggest asking about it somewhere else if you have any technical questions, since most people here aren't familiar with it either. It's sort of beyond the scope of support for ths client itself.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Mar 2007
Posts: 139
S
Solo1 Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Mar 2007
Posts: 139
hmmm...

how about creating a dialog with tabs opening for every network that i am already on (so its not dynamically changing),and in each tab will be the name of the network?

Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
That is nearly the same thing, though it's possible.

To do that you'd need to use the dialog PO3 posted to dynamically generate the dialog and write the contents to a file, /load -rs thefile into your remotes and then /dialog -m thedialogname thedialogname to load the dialog. It would be something *like*

Code:
alias open_network_dialog {
  var %i = 1
  write networkdialog.mrc dialog networkdialog $({)
  write networkdialog.mrc <OTHER DIALOG INFO>
  while ($scon(%i)) {
    ; GET NETWORK FROM connection id $scon(%i).id
    scid $scon(%i).id set %_thenetworkname $network
    write networkdialog.mrc   tab $qt(%_thenetworkname) $+ , <OTHER TAB CONTROL INFO>
    unset %_thenetworkname
    inc %i
  }
  write networkdialog.mrc <REST OF DIALOG>
  write networkdialog.mrc $(})
  load -rs networkdialog.mrc
  dialog -m networkdialog networkdialog
}


edit:
MDX would probably be easier...

Last edited by argv0; 24/12/07 09:29 PM.

- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Mar 2007
Posts: 139
S
Solo1 Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Mar 2007
Posts: 139
Hello ARGV0
I have tried what you asked and got some errors and it does not work. what am i doing wrong? i also notice that you mentioned mdx,

My aim here is to create a dialog exactly like PO3 has shown us but when i call the dialog it will open tabs fro each network that i am on with the networks name in the tab.

Example if i am on two networks it will open a dialog with two tabs with "network1" in one tab and "network2" in the other tab.

Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
The simplest solution would be to choose some limit for the number of possible tabs (networks). You would hard-code that many tabs into your dialog, and then disable/hide the unused tabs. For example, most people wouldn't ever be on more than 10 networks at a single time, so you could make a dialog with 10 tabs.

Another possibilty is to use a listbox instead of tabs. You would have a listbox on the left, and a single set of items on the rest of the dialog. Whenever you choose one of the listbox items, the script would update the items on the right with the appropriate data.

-genius_at_work

Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
The code I posted can do what you're asking for.. however you still need to make plenty of changes to it. The goal was to show you the method, not for you to actually try to use that code, as it is not intended to be functional. Perhaps you can post about specific issues youre having in implementing my solution, or you can try genius's


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Another option is to have "fake" tabs. Just have 1 tab for the current network, then use buttons for moving "right" or "left" a "tab". When pressed, they just load the tab information for the next network into the same tab. It will appear as though it's a new tab, but will always use one tab. If you want to get more creative, you can have 3 network tabs where the middle tab is always the active tab and the left and right tabs show the previous and next network names, but cannot be activated (clicking them and/or clicking buttons will change the active tab's contents to the new network).

Depending what you're doing, this can be a very useful method and is relatively easy to set up. Then, if you wanted to, you could just have a "main" tab that lists all networks and let users click a network from the list and it would bring that network up in the active tab so you don't have to go through all of the networks one by one to get to the one that you want.


Invision Support
#Invision on irc.irchighway.net
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Here is a sample code of what I was describing:

Code:

alias networks {
  if ($dialog(networks)) dialog -a networks
  else dialog -mv networks networks
}

dialog -l networks {
  title "Network Information"
  size -1 -1 270 130
  option dbu

  box "Network Information"        9,   10 10 250 110
  list                            10,   20 20  75 100, autohs 
  list                            11,   97 20  14 100, autohs hide

  text "Network Name:"           100,  120 50 40 10, right
  edit ""                        200,  162 48 60 10, read autohs center

  text "My Nickname:"            101,  120 70 40 10, right
  edit ""                        201,  162 68 60 10, read autohs center
}

on *:DIALOG:networks:init:0:{
  var %n = 0, %nn = $scon(0)
  while (%n < %nn) {
    inc %n
    scon %n
    did -a networks 10 $network
    did -a networks 11 $cid
    scon -r
  }
  networks.load $scon(1).cid
}

on *:DIALOG:networks:sclick:10:{
  var %cid = $did(networks,11,$did(networks,10,1).sel).text
  if ($scid(%cid)) networks.load %cid
}

alias -l networks.load {
  ;$1=scid
  if (!$scid($1)) return
  scid $1

  ; Code to change right-side data here
  ;
  did -ra networks 200 $network
  did -ra networks 201 $me
  ;
  scid -r
}



Ensure you are on several networks.

Then type: /networks

Click the items in the list box on the left.


-genius_at_work

Joined: Mar 2007
Posts: 139
S
Solo1 Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Mar 2007
Posts: 139
Hi Genius_at_work

your example is excellent and pretty much what i needed. just on the right hand side of the dialog i needed an empty scrolling window where i could add lines of text in on certain events and each list box should be associated to each network, could you mod this a little more?

I will now mess with your example a little and hope this would be a step toward a solution.

Kind Regards and thanks to all

Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
You can add whatever items you want on the right. Just add them into the dialog table, then you can add line(s) into the networks.load alias to put information into the items. If you want to manually enter information (typing, checkboxes, etc) into any of the items and retain it later, you will have to save the existing information before you load new data each time you click the left listbox.

-genius_at_work

Joined: Mar 2007
Posts: 139
S
Solo1 Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Mar 2007
Posts: 139
Hi Genius_at_work

I have messed with your dialog example and it works just fine, i am now wondering how to use the list box, for a simple example using an on text event for network1 i want to go into the first tab, and an on text event on network2 to go into the second tab, i paste the modded dialog code

Code:
alias networks {
  if ($dialog(networks)) dialog -a networks
  else dialog -dmv networks networks
}

dialog -l networks {
  title "Client Connections"
  size -1 -1 280 150
  option dbu
  list 10, 11 19 41 89, sort
  text "        Networks", 5, 1 7 50 8, center
  edit "", 3, 60 4 211 137, read multi vsbar
  text "Example", 2, 5 123 50 8, center
  menu "Item1", 1

}


on *:DIALOG:networks:init:0: {
  var %n = 0, %nn = $scon(0)
  while (%n < %nn) {
    inc %n
    scon %n
    did -a networks 10 $network
    scon -r
  }
  networks.load $scon(1).cid
}

on *:DIALOG:networks:sclick:10:{
  var %cid = $did(networks,11,$did(networks,10,1).sel).text
  if ($scid(%cid)) networks.load %cid
}

alias -l networks.load {
  ;$1=scid
  if (!$scid($1)) return
  scid $1

  ; Code to change right-side data here

  scid -r
}


i should be able to work the rest out myself from there, excuse my persistence, i am brand new to using dialogs.

Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Ok, what you need to do is keep track of all of the events/etc for each network somewhere else and then load it into the dialog when you choose a network in the left listbox. The easiest way would be to store the data in text files (one for each network) or in a single INI file with a different header for each network.

Personally, I would probably use an INI file (depending on how much data you want to store). The headers would contain the CID of the network where the data came from. This is better than using the network name alone because you can be on the same network multiple times.

The 'down side' for using this fake tabs design is that you can't load all the data into the dialog at the same time. However, this can actually be a benefit because it forces you to store the data in a less volatile location (text file). This allows the user to close the dialog and reopen it without losing all the existing data.

-genius_at_work

Joined: Mar 2007
Posts: 139
S
Solo1 Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Mar 2007
Posts: 139
Hi Genius_at_work

Thanks for your reply, i can manage to put all the data in a text file and i can manage to load it into a dialog window, probably the best way is using filterbut its not as instant as i wanted it. i want it to save all notices from different networks and it should place it in the dialog as they come in. I am having difficulty achieving this result?

Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Here is the beginning of what needs to happen on the dialog:

Code:
alias networks {
  if ($dialog(networks)) dialog -a networks
  else dialog -mv networks networks
}

dialog -l networks {
  title "Network Information"
  size -1 -1 500 130
  option dbu

  box "Network Information"        9,   10 10 480 110
  list                            10,   20 20  75 100, autohs 
  list                            11,   82 20  14 100, autohs hide

  box "sNotices"                 100,  108 20 372 92, right
  list                           200,  112 28 363 82, hsbar vsbar

}

on *:DIALOG:networks:init:0:{
  var %n = 0, %nn = $scon(0)
  while (%n < %nn) {
    inc %n
    scon %n
    did -a networks 10 $network
    did -a networks 11 $cid
    scon -r
  }
  did -c networks 10 1
  networks.load $scon(1).cid
}

on *:DIALOG:networks:sclick:10:{
  var %cid = $did(networks,11,$did(networks,10,1).sel).text
  if ($scid(%cid)) networks.load %cid
}

on *:SNOTICE:*:{
  if (!$exists($+(dialog\snotice.,$cid,.txt))) mkdir dialog
  write $+("dialog\snotice.,$cid,.txt") $1-

  if (!$dialog(networks)) return
  var %cid = $did(networks,11,$did(networks,10,1).sel).text
  if (%cid == $cid) {
    did -a networks 200 $1-
    did -z networks 200
    did -c networks 200 $did(networks,200).lines
    did -u networks 200 $did(networks,200).lines
  }
}

alias -l networks.load {
  ;$1=scid
  if (!$scid($1)) return
  scid $1

  ; Code to change right-side data here
  ;
  filter -fco $+("dialog\snotice.,$cid,.txt") networks 200 *
  did -z networks 200
  did -c networks 200 $did(networks,200).lines
  did -u networks 200 $did(networks,200).lines
  ;
  scid -r
}



In the modified code you posted, I noticed that you removed list 11. That hidden listbox is important to the operation of the dialog. It keeps track of the CID for each connection and allows you to reference them later. It also means that you CANNOT sort listbox 10. If you do, the networks will be all mixed up.

-genius_at_work

Joined: Mar 2007
Posts: 139
S
Solo1 Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Mar 2007
Posts: 139
Hi Genius_at_work thanks for all your amazing help.


Link Copied to Clipboard