mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Apr 2005
Posts: 53
A
aDevil Offline OP
Babel fish
OP Offline
Babel fish
A
Joined: Apr 2005
Posts: 53
alias @notice /dialog -m @notice @notice
dialog @notice {
title "Notice"
size -1 -1 130 410
list 1, 10 10 100 40
list 2, 10 45 100 65
button "Ok", 3, 20 385 40 20, ok
}


on *:dialog:@notice:init:0:{
/set %i 1
%veg = $query(0) + 1
while (%i != %veg) {
did -a $dname 1 $query(%i)
if ($read(notice.dat,s,$query(%i)) == $null) { /write notice.dat $query(%i) @notice }
inc %i
}
/unset %i
/unset %veg
did -a $dname 2 @notice
did -a $dname 2 Query
did -a $dname 2 Newpvt
}


on *:dialog:@notice:sclick:1: {
set %a $read(notice.dat,s,$did($dname,$did,$did($dname,$did).sel))
did -r $dname 2
if (%a == @notice) { did -a $dname 2 > @notice < }
else { did -a $dname 2 @notice }
if (%a == query) { did -a $dname 2 > Query < }
else { did -a $dname 2 Query }
if (%a == newpvt) { did -a $dname 2 > Newpvt < }
else { did -a $dname 2 Newpvt }
unset %a
}


on *:dialog:@notice:sclick:2: {
set %b $read(notice.dat,s,$did($dname,1,$did($dname,1).sel))
set %c $did($dname,$did,$did($dname,$did).sel)
tokenize 32 %c
if ($2 != %b) {
set %b $read(notice.dat,s,$did($dname,1,$did($dname,1).sel))
set %b $readn
write -l $+ %b notice.dat $did($dname,1,$did($dname,1).sel) $did($dname,$did,$did($dname,$did).sel)
set %a $read(notice.dat,s,$did($dname,1,$did($dname,1).sel))
did -r $dname 2
if (%a == @notice) { did -a $dname 2 > @notice < }
else { did -a $dname 2 @notice }
if (%a == query) { did -a $dname 2 > Query < }
else { did -a $dname 2 Query }
if (%a == newpvt) { did -a $dname 2 > Newpvt < }
else { did -a $dname 2 Newpvt }
unset %a
}
unset %b
unset %c
}


This script working for me good, but in the list 2nd, which have the id 2 don't working good, because when I click on an item the selection disappears, not remaining there. Sorry for my bad english, can anybody help me?

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
When I click an item in ListBox 2 it seems to be fine. When clicking @notice it changes to > @notice <. As do the other 2. smile

Joined: Apr 2005
Posts: 53
A
aDevil Offline OP
Babel fish
OP Offline
Babel fish
A
Joined: Apr 2005
Posts: 53
But click on item 2 in the ListBox 2, and then click again on this item also. And look the difference, the 2 nd time u will see selected text smile

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Do you mean when clicking an item it changes to > @notice < but is no longer selected? That's the only thing I can see throwing it off. Other than that it seems to work ok for me. smile

Joined: Apr 2005
Posts: 53
A
aDevil Offline OP
Babel fish
OP Offline
Babel fish
A
Joined: Apr 2005
Posts: 53
Yes you are quite right, it is no longer selected. smile

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Code:
alias @notice /dialog -m @notice @notice
dialog @notice {
  title "Notice"
  size -1 -1 130 410
  list 1, 10 10 100 40
  list 2, 10 45 100 65
  button "Ok", 3, 20 385 40 20, ok
}


on *:dialog:@notice:init:0:{
  /set %i 1
  %veg = $query(0) + 1
  while (%i != %veg) { 
    did -a $dname 1 $query(%i)
    if ($read(notice.dat,s,$query(%i)) == $null) { /write notice.dat $query(%i) @notice }
    inc %i
  }
  /unset %i
  /unset %veg
  did -a $dname 2 @notice
  did -a $dname 2 Query
  did -a $dname 2 Newpvt
}


on *:dialog:@notice:sclick:1: {
  set %a $read(notice.dat,s,$did($dname,$did,$did($dname,$did).sel))
  did -r $dname 2 
  if (%a == @notice) { did -a $dname 2 &gt; @notice &lt; } 
  else { did -a $dname 2 @notice }
  if (%a == query) { did -a $dname 2 &gt; Query &lt; } 
  else { did -a $dname 2 Query }
  if (%a == newpvt) { did -a $dname 2 &gt; Newpvt &lt; } 
  else { did -a $dname 2 Newpvt }
  unset %a
}


on *:dialog:@notice:sclick:2: {
  set %b $read(notice.dat,s,$did($dname,1,$did($dname,1).sel))
  set %c $did($dname,$did,$did($dname,$did).sel)
  [color:red]set %d $did($dname,$did).sel[/color]
  tokenize 32 %c
  if ($2 != %b) {
    set %b $read(notice.dat,s,$did($dname,1,$did($dname,1).sel))
    set %b $readn
    write -l $+ %b notice.dat $did($dname,1,$did($dname,1).sel) $did($dname,$did,$did($dname,$did).sel)
    set %a $read(notice.dat,s,$did($dname,1,$did($dname,1).sel))
    did -r $dname 2 
    if (%a == @notice) { did -a $dname 2 &gt; @notice &lt; } 
    else { did -a $dname 2 @notice }
    if (%a == query) { did -a $dname 2 &gt; Query &lt; } 
    else { did -a $dname 2 Query }
    if (%a == newpvt) { did -a $dname 2 &gt; Newpvt &lt; } 
    else { did -a $dname 2 Newpvt }
    unset %a
  }
  [color:red]did -c @notice 2 %d[/color]
  unset %b
  unset %c
  [color:red]unset %d[/color]
}


I added a %d var to store the line selected. It then selects that line and unsets the var.

Joined: Apr 2005
Posts: 53
A
aDevil Offline OP
Babel fish
OP Offline
Babel fish
A
Joined: Apr 2005
Posts: 53
Thanks, it is working cool smile

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Good. You're welcome. smile


Link Copied to Clipboard