Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Level III

select/deselect file in list box

qual_list= Files In Directory( "C:\Users\mlachhab\Documents\20220309 - Exercice Scripting Magid\REPERTOIRE A" );

nw= New Window( "Ex1",
	V List Box(
		Outline Box( "Choix_Du_Dossier",<<BackgroundColor( 19 );
			dt=list Box( qual_list);
			obj= dt << get selected;	
				If(obj << Selected , obj << Deselect);
	Lineup Box( N Col( 2 ), spacing( 20 ),
		Button Box( "OK",
			nw << Close Window ),
		Button Box( "ANNULER",
			nw << Close Window ),

Hello, I want to select/deselect files in my List box, but when I select one file, I can't deselect it.


Level VI

Re: select/deselect file in list box

Your code seems fine to me.  click to select, ctrl+click to de-select (on a PC). Probably cmd+click on a Mac.

Super User

Re: select/deselect file in list box

To unselect a selected entry in a List Box(), simply hold down the CNTL key and then click on the selected entry.   It will then change to unselected.


Concerning your seem to be guessing at the syntax to use.  What you need to do to find out what messages are available to a given object(in this case a List Box) is to open the Scripting Index, and go to the entry for the specific object you are using.


There you will see that the Set Selected message is used for both selecting and unselecting   Also, the Set Selection message uses the Index for the selected so you need to use the Get Selected Index rather than the Get Selected