mIRC Home    About    Download    Register    News    Help

Print Thread
#89538 08/07/04 12:35 AM
Joined: Apr 2004
Posts: 66
C
Cyrex Offline OP
Babel fish
OP Offline
Babel fish
C
Joined: Apr 2004
Posts: 66
The script I am writing uses a @window with a listbox. I was wondering how I could make it so a user cannot do a multi select of lines in the listbox. I just want the user to be able to select one line at a time.

#89539 08/07/04 12:56 AM
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
You can't unselect the line when they select one, but you can make sure only one line is selected when you do your commands:

if ($sline(@win,0) == 1) { dostuff }
else { echo -ac Info * only select one line in @win }


New username: hixxy
#89540 08/07/04 08:11 AM
Joined: Aug 2003
Posts: 314
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2003
Posts: 314
Code:
menu @Window {
  lbclick:{
    var %w = $menu
    if ($sline(%w,0) = 1) { %sel.ln = $sline(%w,1).ln }
    elseif (!$sline(%w,0)) { unset %sel.ln } 
    else { 
      var %l = $sline(%w,$iif($sline(%w,1).ln = %sel.ln,2,1)).ln 
      sline -sl %w %l
      %sel.ln = %l
    }
  }
}
on *:close:@Window:{ unset %sel.ln }


Use a menu event as shown to detect the selections in the custom window. Using a global variable you can follow which line is meant to be selected and so when you attempt to select multiple selections in the listbox it will only let you select a single one.

Edit: Found event.

Last edited by Sigh; 08/07/04 08:51 AM.

Link Copied to Clipboard