Hi David,

If you did not use the sort feature of the simple dialog, then this would be
possible for you to manage yourself.  you could keep a list of what's in the
listbox, and when something is returned, you could look it's position up in
your list.  then after you delete it, and reload the simple dialog, you
could pass in the position to looked up as the item to select.

If you do sort it however, then, it looks like you'd have to manage your own
listbox until Aaron can get to this.

The good news is that creating a dialog with your own listbox, thanks to
UIDesign, isn't much more work than using simpleDialogs.  Adding items to
this listbox in your app isn't any different from adding them to the
simpleDialogs listbox.  And the event handler (the only real difference) is
so easy you could copy one from the class #30 examples, and change it only
slightly to handle your listbox.

If you think about it, and think it is more difficult than I think, just let
me know and I'll help you out with it.

Chip


-----Original Message-----
From: David [mailto:[email protected]] 
Sent: Friday, December 02, 2011 12:49 AM
To: [email protected]
Subject: Re: SimpleDialogs Update

Thanks Aaron.
That was quick and helpful. I just have a small wish more, for an
improvement to the ListBox property.

For an example, let me just do this:

You let a routine in your app populate the listbox with files in a folder. 
Then, you let the user choose a file, from the ListBox. Let's say, he
chooses file 3, and the listbox has ten entries. Your app further let the
user hit a Delete key, and the file will be deleted. What then happens?

Well, the way things stand to day, you now will populate the listbox once
again, and the result will be a list of nine files. And, you are placed on
the first of the entries.

My wish would have been, that there had been some kind of an Index property
of the ListBox routine. How about something like:

>> Set s =
>> SharedObjects("com.gwmicro.gwtoolkit.simpledialogs").listboxdialog
>> s.additem "red", "red"
>> s.additem "green", "green"
>> s.additem "blue", "blue"
>> s.sort = true
>> s.defaultbutton = "&Select"
>> s.cancelbutton = "Close"
>> s.DefaultSelect = 2
>> print s.ChooseItem("Select a color")
X = S.CurrentIndex

Then, when you call the listbox routine next time, you could do:
    S.DefaultSelection = X
, And the user would be directly on the spot where he left off. That is, in 
my example, since he deleted file 3, he now will be placed on the 'new' file

3... Hope that example made sense. Smile. Bit late here, but still hope you 
get the meaning of the thing.

could such a small thing easily be implemented? My above example of a list 
of files, would only be one case where the CurrentIndex variable could be 
useful. Same goes with a listbox wthat was related to an array, or any other

listbox that might be updated somehow down the road. If your list only does 
contain ten entries, it is only anoying that you will be taken back to a 
start point (first entry, or whatever is hard coded in the 
DefaultSelection). But what if your list is populated by 100 entries, you 
are at 77, and the list gets updated, and DefaultSelection has been 
hardcoded to 1? Smile.


From: "Aaron Smith" <[email protected]>
Cc: <[email protected]>
Sent: Wednesday, November 30, 2011 9:10 PM
Subject: Re: SimpleDialogs Update


> OOps. Make that DefaultSelection.
>
> Thanks,
>
> Aaron
>
> On 11/30/2011 1:28 PM, Aaron Smith wrote:
>> Greetings,
>>
>> The latest version of the GW Toolki (8.4.4) has support for the 
>> DefaultSelect property in the SimpleDialogs object:
>>
>> Set s = 
>> SharedObjects("com.gwmicro.gwtoolkit.simpledialogs").listboxdialog
>> s.additem "red", "red"
>> s.additem "green", "green"
>> s.additem "blue", "blue"
>> s.sort = true
>> s.defaultbutton = "&amp;Select"
>> s.cancelbutton = "Close"
>> s.DefaultSelect = 2
>> print s.ChooseItem("Select a color")
>>
>> That would result in a dialog with the green list box item automatically 
>> selected.
>>
>> Aaron
>>
>
> -- 
> Aaron Smith
> Web Development * App Development * Product Support Specialist
> GW Micro, Inc. * 725 Airport North Office Park, Fort Wayne, IN 46825
> 260-489-3671 * gwmicro.com
>
> To insure that you receive proper support, please include all past
> correspondence (where applicable), and any relevant information
> pertinent to your situation when submitting a problem report to the GW
> Micro Technical Support Team.
> 

Reply via email to