SBP ÿ½ Written by Simon Tramner - some time ago ÿ½ Supplied by Scott McDaniel ÿ½ This program displays 2 lists, and allows the user ÿ½ to move items between each. It demonstrates some neat ÿ½ Dialog Box handling ÿ½ Heavily modified by Max Perry Compuserv id 100237,3210 ÿ½ on 23rd April, 1995 ÿ½ Well, not really modified, just heaps of additions. ÿ½ Simon's original program was a shell. I have written all the routines ÿ½ that start from SUB ActivateDiag() ÿ½ This program runs happily by itself. It builds a dummy array of the ÿ½ numbers from 1 to 50. These are displayed in a list box on the ÿ½ left hand side of a dialog. The user can move any number of these ÿ½ numbers to the list box on the right hand side of the dialog. ÿ½ Once the RHS list box is populated, the user can move numbers ÿ½ from either box to the other. ÿ½ When an entry is highlighted in the receiving box, then the ÿ½ selected items are placed before the highlighted entry. ÿ½ When nothing is highlighted, the selected entries are placed ÿ½ at the end of the list. ÿ½ Naturally this is a simple mickey mouse demo. ÿ½ A few (more) comments are in order:- ÿ½ I am new to OOP development ÿ½ However, I concur with Lawrence Walter's comments that SB ÿ½ is not a true OOP environment. For example, in this program ÿ½ there is too much code duplication because a called SUB ÿ½ does not inherit the declarations of the caller ÿ½ This program is of course non-copyrighted. Beware that I ÿ½ not an expert. In fact I welcome any constructive criticism. ÿ½ When this program populates a list box, there is screen flicker ÿ½ as numbers enter the box. Does anyone know how to stop this? ÿ½ I could not use the example on page 223 of the Programmer's ÿ½ Guide to populate a list box. This program uses the .Add method ÿ½ Is the Prog Guide wrong, or is it me? ÿÿmain() ÿ¾ÿñÿt ÿƒMULTISEL() ÿ’ÿÿ  ÿÿMULTISEL() ÿ×dlg ÿUDialog ÿ×control ÿUDialogControl Superbase.Dialogs.Add("DiSequence") ÿÊdlg ÿSuperbase.Dialogs.DiSequence dlg.Move(6,7,248,182) dlg.Captionÿ"Dialog Title" dlg.FontNameÿ"MS Sans Serif" dlg.FontSizeÿ8 dlg.OnActivateÿ"ActivateDiag" ÿÊcontrol ÿdlg.Add("DialogListBox1","DialogListBox") control.Move(2,4,92,129) control.ScrollBarsÿ2 control.multiselectÿÿ1 control.OnDblClickÿ"MoveRight" control.OnSelChangeÿ"CheckSel1" control.Sortedÿ0 ÿÊcontrol ÿdlg.Add("DialogListBox2","DialogListBox") control.Move(146,4,95,137) control.ScrollBarsÿ2 control.multiselectÿÿ1 control.OnDblClickÿ"MoveLeft" control.OnSelChangeÿ"CheckSel2" control.Sortedÿ0 ÿÊcontrol ÿdlg.Add("MoveRight","DialogCommandButton") control.Move(97,27,46,14) control.Captionÿ"Move >>" control.Valueÿ0 control.Cancelÿ1 control.OnClickÿ"MoveRight" ÿÊcontrol ÿdlg.Add("MoveLeft","DialogCommandButton") control.Move(97,57,46,14) control.Captionÿ"<< Move" control.Valueÿ0 control.Cancelÿ1 control.OnClickÿ"MoveLeft" ÿÊcontrol ÿdlg.Add("MoveAllRight","DialogCommandButton") control.Move(97,83,46,14) control.Captionÿ"Move All >>" control.Valueÿ0 control.Cancelÿ1 control.OnClickÿ"MoveAllRight" ÿÊcontrol ÿdlg.Add("MoveAllLeft","DialogCommandButton") control.Move(97,115,46,14) control.Captionÿ"<< Move All" control.Valueÿ0 control.Cancelÿ1 control.OnClickÿ"MoveAllLeft" ÿÊcontrol ÿdlg.Add("DialogCommandButton1","DialogCommandButton") control.Move(13,152,61,19) control.Captionÿ"OK" control.Valueÿ0 control.Cancelÿ1 control.OnClickÿ"FinishDiag" ÿÊcontrol ÿdlg.Add("Reset","DialogCommandButton") control.Move(88,152,61,19) control.Captionÿ"Reset" control.Valueÿ0 control.Cancelÿ1 control.OnClickÿ"ResetLists" ÿÊcontrol ÿdlg.Add("DialogCommandButton3","DialogCommandButton") control.Move(164,152,61,19) control.Captionÿ"Cancel" control.Valueÿ0 control.Cancelÿ1 control.OnClickÿ"CancelDiag" dlg.SetActive(ÿ1) ÿ’ÿÿ ÿÿActivateDiag() ÿßÿe ÿ×i%% ÿ×ListBox1 ÿUDialogListBox ÿ×ListBox2 ÿUDialogListBox ÿÊListBox1 ÿSuperbase.Dialogs.DiSequence.DialogListBox1 ÿÊListBox2 ÿSuperbase.Dialogs.DiSequence.DialogListBox2 ÿ›i%%ÿ1ÿq50 ListBox1.List.Add(ÿ(i%%,"999")) ÿ±i%% ÿßÿ³ ÿ’ÿÿ ÿÿCancelDiag() ÿ×dlg ÿUDialog ÿÊdlg ÿSuperbase.Dialogs.DiSequence dlg.SetActive(0) ÿ’ÿÿ ÿÿCheckSel1() ÿ½ Do nothing ÿ’ÿÿ ÿÿCheckSel2() ÿ½ Do nothing ÿ’ÿÿ  ÿÿFinishDiag() ÿ×dlg ÿUDialog ÿÊdlg ÿSuperbase.Dialogs.DiSequence dlg.SetActive(0) ÿ’ÿÿ ÿÿMoveAllRight() ÿÊÿÂÿŸ"You can code this because...." ÿÂ"I will not use this in","my completed application",100 ÿ’ÿÿ ÿÿMoveAllLeft() ÿÊÿÂÿŸ"You can code this because...." ÿÂ"I will not use this in","my completed application",100 ÿ’ÿÿ ÿÿMoveRight() ÿ½ The user can move 1 or more left side entries to the right side ÿ½ If there is no selection on the RHS, then the selected LHS entries ÿ½ are added to the end of the list on the RHS ÿ½ If there is a selection on the RHS, then the selected LHS entries ÿ½ are added to the RHS list BEFORE the selected entry Superbase.CursorTypeÿ0'MOUSE OFF ÿ×i%%,j%%,k%%,l%%,List1$(50),List2$(50) ÿ×ListBox1 ÿUDialogListBox ÿ×ListBox2 ÿUDialogListBox ÿÊListBox1 ÿSuperbase.Dialogs.DiSequence.DialogListBox1 ÿÊListBox2 ÿSuperbase.Dialogs.DiSequence.DialogListBox2 ÿ¡ListBox1.SelCountÿ0ÿp ÿ¡ListBox2.SelCountÿ0ÿp ÿ¡ListBox2.SelCountÿ1ÿp  ÿÊÿÂÿŸ"Oops - Error"  ÿÂ"You have selected more than 1 entry","on the right hand side",100 ÿ^  k%%ÿ1  ÿØÿOListBox2.Selected(k%%) List2$(k%%ÿ1)ÿListBox2.List(k%%) k%%ÿk%%ÿ1  ÿÙ  j%%ÿk%%  ÿ›i%%ÿ1ÿqListBox1.ListCount ÿ¡ListBox1.Selected(i%%)ÿp List2$(j%%ÿ1)ÿListBox1.List(i%%) j%%ÿj%%ÿ1 ÿ^ List1$(l%%)ÿListBox1.List(i%%) l%%ÿl%%ÿ1 ÿ’ÿ¡  ÿ±i%%  ÿØk%%ÿ ListBox2.ListCountÿ1 List2$(j%%ÿ1)ÿListBox2.List(k%%) j%%ÿj%%ÿ1:k%%ÿk%%ÿ1  ÿÙ  ListBox1.List.Clear()  j%%ÿ0  ÿØList1$(j%%)ÿ"" ListBox1.List.Add(List1$(j%%)) j%%ÿj%%ÿ1  ÿÙ  ListBox2.List.Clear()  j%%ÿ0  ÿØList2$(j%%)ÿ"" ListBox2.List.Add(List2$(j%%)) j%%ÿj%%ÿ1  ÿÙ ÿ’ÿ¡ ÿ^ ÿ›i%%ÿ1ÿqListBox1.ListCount  ÿ¡ListBox1.Selected(i%%)ÿp ListBox2.List.Add(ListBox1.List(i%%))  ÿ^ List1$(j%%)ÿListBox1.List(i%%) j%%ÿj%%ÿ1  ÿ’ÿ¡ ÿ±i%% ListBox1.List.Clear() j%%ÿ0 ÿØList1$(j%%)ÿ""  ListBox1.List.Add(List1$(j%%))  j%%ÿj%%ÿ1 ÿÙ ÿ’ÿ¡ ÿ^ ÿÊÿÂÿŸ"Oops - Error" ÿÂ"I have nothing to do because","you haven't selected anything to move right",100 ÿ’ÿ¡ Superbase.CursorTypeÿ1'MOUSE ON ÿ’ÿÿ  ÿÿMoveLeft() ÿ½ The user can move 1 or more right side entries to the left side ÿ½ If there is no selection on the LHS, then the selected RHS entries ÿ½ are added to the end of the list on the LHS ÿ½ If there is a selection on the LHS, then the selected RHS entries ÿ½ are added to the LHS list BEFORE the selected entry Superbase.CursorTypeÿ0'MOUSE OFF ÿ×i%%,j%%,k%%,l%%,List1$(50),List2$(50) ÿ×ListBox1 ÿUDialogListBox ÿ×ListBox2 ÿUDialogListBox ÿÊListBox1 ÿSuperbase.Dialogs.DiSequence.DialogListBox1 ÿÊListBox2 ÿSuperbase.Dialogs.DiSequence.DialogListBox2 ÿ¡ListBox2.SelCountÿ0ÿp ÿ¡ListBox1.SelCountÿ0ÿp ÿ¡ListBox1.SelCountÿ1ÿp  ÿÊÿÂÿŸ"Oops - Error"  ÿÂ"You have selected more than 1 entry","on the left hand side",100 ÿ^  k%%ÿ1  ÿØÿOListBox1.Selected(k%%) List2$(k%%ÿ1)ÿListBox1.List(k%%) k%%ÿk%%ÿ1  ÿÙ  j%%ÿk%%  ÿ›i%%ÿ1ÿqListBox2.ListCount ÿ¡ListBox2.Selected(i%%)ÿp List2$(j%%ÿ1)ÿListBox2.List(i%%) j%%ÿj%%ÿ1 ÿ^ List1$(l%%)ÿListBox2.List(i%%) l%%ÿl%%ÿ1 ÿ’ÿ¡  ÿ±i%%  ÿØk%%ÿ ListBox1.ListCountÿ1 List2$(j%%ÿ1)ÿListBox1.List(k%%) j%%ÿj%%ÿ1:k%%ÿk%%ÿ1  ÿÙ  ListBox2.List.Clear()  j%%ÿ0  ÿØList1$(j%%)ÿ"" ListBox2.List.Add(List1$(j%%)) j%%ÿj%%ÿ1  ÿÙ  ListBox1.List.Clear()  j%%ÿ0  ÿØList2$(j%%)ÿ"" ListBox1.List.Add(List2$(j%%)) j%%ÿj%%ÿ1  ÿÙ ÿ’ÿ¡ ÿ^ ÿ›i%%ÿ1ÿqListBox2.ListCount  ÿ¡ListBox2.Selected(i%%)ÿp ListBox1.List.Add(ListBox2.List(i%%))  ÿ^ List1$(j%%)ÿListBox2.List(i%%) j%%ÿj%%ÿ1  ÿ’ÿ¡ ÿ±i%% ListBox2.List.Clear() j%%ÿ0 ÿØList1$(j%%)ÿ""  ListBox2.List.Add(List1$(j%%))  j%%ÿj%%ÿ1 ÿÙ ÿ’ÿ¡ ÿ^ ÿÊÿÂÿŸ"Oops - Error" ÿÂ"I have nothing to do because","you haven't selected anything to move left",100 ÿ’ÿ¡ Superbase.CursorTypeÿ1'MOUSE ON ÿ’ÿÿ  ÿÿResetLists() ÿßÿe ÿ×i%% ÿ×ListBox1 ÿUDialogListBox ÿ×ListBox2 ÿUDialogListBox ÿÊListBox1 ÿSuperbase.Dialogs.DiSequence.DialogListBox1 ÿÊListBox2 ÿSuperbase.Dialogs.DiSequence.DialogListBox2 ListBox1.List.Clear() ListBox2.List.Clear() ÿ›i%%ÿ1ÿq50 ListBox1.List.Add(ÿ(i%%,"999")) ÿ±i%% ÿßÿ³ ÿ’ÿÿ