mIRC Home    About    Download    Register    News    Help

Print Thread
Again combo box... #116355 04/04/05 01:27 PM
Joined: Aug 2004
Posts: 42
T
The_Only Offline OP
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Aug 2004
Posts: 42
So... here's the problem.
I made a combo box type "list". But when I add a new item through the button i designed, it appears at the top. Is there a way to make the list-box fill in the same order as the data is stored as different lines in the *.ini file? I mean... the new item to be added is stored as a new line at the bottom of the *.ini. So can the item appear at the bottom in the box too?

Re: Again combo box... #116356 04/04/05 02:05 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Just something I whipped up, it doesn't read from an INI file though. Simple *.txt.

But it does load the data the order you added it.

Code:
dialog com {
  title "Com"
  size -1 -1 64 116
  option dbu
  combo 1, 2 2 60 90, size
  button "Add", 2, 11 94 15 8
  button "Del", 3, 38 94 15 8
  button "Close", 4, 4 106 55 8
}


On *:Dialog:com:init:0: {
  if ($lines(com.txt) >= 1) { .play -s com.txt 10 }
}

On *:Dialog:com:sclick:2: {
  if ($did(1)) {
    if ($read(com.txt,w,did -a com 1 $did($dname,1))) { echo -a $did(1) already exists. | halt }
    did -a $dname 1 $did(1)
    write com.txt did -a com 1 $did($dname,1)
    echo -a Added $+($did($dname,1),.)
  }
}

On *:Dialog:com:sclick:3: {
  if ($did(1).sel) {
    did -d $dname 1 $did(1).sel
    write -dw $+("*,$did(1).sel,*") com.txt
    echo -a Deleted $+($did($dname,1),.)
  }
}

On *:Dialog:com:sclick:4: {
  dialog -x com com
}

Re: Again combo box... #116357 04/04/05 02:18 PM
Joined: Aug 2004
Posts: 42
T
The_Only Offline OP
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Aug 2004
Posts: 42
Thanks.

Oh yeah! Another question. Since the data in my "database" *.txt file is a list of IPs (each on new line) to be ignored, is there a way to make mirc always add them to the ignore list in the Address Book on start?

Re: Again combo box... #116358 04/04/05 02:22 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Code:
On *:Start: {
  var %x = $lines(database.txt)
  while (%x) {
    ignore $gettok($read(database.txt,%x),5,32)
    dec %x
  }
}

dialog database {
  title "The Only"
  size -1 -1 64 116
  option dbu
  combo 1, 2 2 60 90, size
  button "Add", 2, 11 94 15 8
  button "Del", 3, 38 94 15 8
  button "Close", 4, 4 106 55 8
}


On *:Dialog:database:init:0: {
  if ($lines(database.txt) >= 1) { .play -s database.txt 10 }
}

On *:Dialog:database:sclick:2: {
  if ($did(1)) {
    if ($read(database.txt,w,did -a database 1 $did($dname,1))) { echo -a $did(1) already exists. | halt }
    did -a $dname 1 $did(1)
    write database.txt did -a database 1 $did($dname,1)
    echo -a Added $+($did($dname,1),.)
  }
}

On *:Dialog:database:sclick:3: {
  if ($did(1).sel) {
    did -d $dname 1 $did(1).sel
    write -dw $+("*,$did(1).sel,*") database.txt
    echo -a Deleted $+($did($dname,1),.)
  }
}

On *:Dialog:database:sclick:4: {
  dialog -x database database
}

Last edited by SladeKraven; 04/04/05 02:24 PM.
Re: Again combo box... #116359 04/04/05 02:23 PM
Joined: Aug 2004
Posts: 42
T
The_Only Offline OP
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Aug 2004
Posts: 42
by the way... sorry it wasn't a combo box frown
Code:
list 4, 7 50 134 154, size extsel vsbar

A list box...
Sorry

Re: Again combo box... #116360 04/04/05 02:36 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Ok, well I've added an edit control and a list to make it look like a combo hehehe...
Code:
On *:Start: {
  var %x = $lines(database.txt)
  while (%x) {
    ignore $gettok($read(database.txt,%x),5,32)
    dec %x
  }
}

dialog database {
  title "database"
  size -1 -1 66 116
  option dbu
  list 1, 3 14 60 80, size
  button "Add", 2, 11 96 15 8
  button "Del", 3, 38 96 15 8
  button "Close", 4, 4 106 55 8
  edit "", 5, 3 2 60 10
}

On *:Dialog:database:init:0: {
  if ($lines(database.txt) >= 1) { .play -s database.txt 10 }
}

On *:Dialog:database:sclick:2: {
  if ($did(5)) {
    if ($read(database.txt,w,did -a database 1 $did($dname,5))) { echo -a $did(5) already exists. | halt }
    did -a $dname 1 $did(5)
    write database.txt did -a database 1 $did($dname,5)
    echo -a Added $+($did($dname,5),.)
  }
}

On *:Dialog:database:sclick:3: {
  if ($did(1).sel) {
    did -d $dname 1 $did(1).sel
    write -dw $+("*,$did(1).sel,*") database.txt
    echo -a Deleted $+($did($dname,1),.)
  }
}

On *:Dialog:database:sclick:4: {
  dialog -x database database
}

Re: Again combo box... #116361 04/04/05 03:23 PM
Joined: Aug 2004
Posts: 42
T
The_Only Offline OP
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Aug 2004
Posts: 42
Thanks pal smile It works great!

And sorry that I said "combo" box... They look almost the same and I got confused :P

Offtopic: Can anyone see my avatar? Because it's uploaded on a Bulgarian free server and I'm not sure if the server could be accessed from foreign countries.

Re: Again combo box... #116362 04/04/05 03:26 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
You're welcome mate. smile

Re: Again combo box... #116363 04/04/05 03:42 PM
Joined: Aug 2004
Posts: 42
T
The_Only Offline OP
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Aug 2004
Posts: 42
Doh I found a bug.

When you open the dialog "database" ( /dialog -m database database ) and for example you fill in 4 texts. They appear and when you load the dialog again they appear at the same order. But when you select for example the last one or the 3rd one or whatever and press "del" it deletes it but when you reopen the diaolg you can see that it actually deleted the first line, not the one you selected,

Re: Again combo box... #116364 04/04/05 03:54 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Woops, my apologies!

Well this seems to work, thus far.

Code:
On *:Start: {
  var %x = $lines(database.txt)
  while (%x) {
    ignore $gettok($read(database.txt,%x),5,32)
    dec %x
  }
}

dialog database {
  title "database"
  size -1 -1 66 116
  option dbu
  list 1, 3 14 60 80, size
  button "Add", 2, 11 96 15 8
  button "Del", 3, 38 96 15 8
  button "Close", 4, 4 106 55 8
  edit "", 5, 3 2 60 10
}

On *:Dialog:database:init:0: {
  if ($lines(database.txt) >= 1) { .play -s database.txt 10 }
}

On *:Dialog:database:sclick:2: {
  if ($did(5)) {
    if ($read(database.txt,w,did -a database 1 $did($dname,5))) { echo -a $did(5) already exists. | halt }
    did -a $dname 1 $did(5)
    write database.txt did -a database 1 $did($dname,5)
    echo -a Added $+($did($dname,5),.)
  }
}

On *:Dialog:database:sclick:3: {
  if ($did(1).sel) {
    write -dw $+("*,$did(1,$did(1).sel),*") database.txt
    did -d $dname 1 $did(1).sel
  }
}

On *:Dialog:database:sclick:4: {
  dialog -x database database
}

Last edited by SladeKraven; 04/04/05 03:55 PM.
Re: Again combo box... #116365 04/04/05 04:06 PM
Joined: Aug 2004
Posts: 42
T
The_Only Offline OP
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Aug 2004
Posts: 42
Thanks smile

Re: Again combo box... #116366 04/04/05 04:07 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
You're welcome. smile

Re: Again combo box... #116367 04/04/05 04:12 PM
Joined: Aug 2004
Posts: 42
T
The_Only Offline OP
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Aug 2004
Posts: 42
Oh and by the way... is there a way not to add the network i'm logged on to when ignoring? Cause when I type "/ignore -pcntdik *!*@whatever.com" it also adds the network I'm logged on to in the Address Book.

Re: Again combo box... #116368 04/04/05 04:18 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Sorry mate I'm a little tired, so I'm having trouble understanding hehe. Do you want the ignore to function on all networks?

Re: Again combo box... #116369 04/04/05 04:29 PM
Joined: Aug 2004
Posts: 42
T
The_Only Offline OP
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Aug 2004
Posts: 42
Am... so when you log on to a server to chat, and when you tipe "/ignore -pcntdik *!*@blablabla.bla" it ignores that Host/IP right? And when you go to the Address Book -> Control -> Ignore you can see "*!*@blablabla.bla" added with parameters "pcntdik" (private, ctcp etc.) but you can also see the network group/server address you were logged on to or to when ignoring. That makes the ignore valid only on this server/group. So I want to ignore someone with the /ignore command without adding the network/server address. Is it possible?

Sorry for explaining it like that but it will make it easier for you to understand me smile

Re: Again combo box... #116370 04/04/05 04:33 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
/ignore -w <Host/IP>

Re: Again combo box... #116371 04/04/05 04:37 PM
Joined: Aug 2004
Posts: 42
T
The_Only Offline OP
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Aug 2004
Posts: 42
LOL! Looks like I have to re-read the mirc help file about ignore again :P It seems i've missed it the last time I read it smile

Thanks again for everything smile

Re: Again combo box... #116372 04/04/05 04:39 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Hehe, you're welcome smile