Hi David,
 
As for no item being selected, I can duplicate this, and don't see you're
doing anything incorrectly; so I'd copy this to Aaron at GW if I were you.
 
I cannot duplicate the problem with "cancel" causing an error, and don't
have any thoughts there.
 
Chip
 

  _____  

From: David [mailto:[email protected]] 
Sent: Tuesday, November 29, 2011 10:21 PM
To: [email protected]
Subject: SimpleDialogs - Wonder what I am doing wrong


I was playing around with a small app, based on one of the samples found in
the GWToolkit documentation. Here is the essential code snip-it, that causes
the problem. The rest of the code, has been generated by Framework.
 
Function ChooseFile() 
 Dim FileList: Set FileList = SO_SimpleDialogs.ListBoxDialog 
 For Each File In FilesDir.Files
  If LCase( File.Name )<> "index.dat" Then FileList.AddItemFile.Name, File 
 Next '
 FileList.Sort = True
 FileList.DefaultButton = "Delete"
 FileList.CancelButton = "Close"
 ChooseFile = FileList.ChooseItem( "Files found:" )
End Function 
 
MsgBox ChooseFile
 

I run this on a small folder, and the listbox populates just fine. The
screen shows up, with two buttons at the bottom: Delete, and Close.
 
First of all, When the listbox opens, I have to press one of my cursor keys,
so as to select the first item on the list. Is there any way for me to set
up the listbox, so that item 1 always will be selected when the screen
opens?
 
Secondly, if I run the above code, I can select the Delete - or default -
button. The MsgBox will then show me the filename of the file I chose. And,
of course, I want to handle things from there, and have clear to me what to
do.
 
But if I now choose the Close button - which is defined as the CancelButton
of the listbox - I get the following error thrown at me:
 
Error Details:
Description: Object variable not set
Line: 392 - ChooseFile = FileList.ChooseItem( "Files found:" )
 
Why? What is wrong in my code? Far as I can see, I have coded pretty much
what the example in the documentation said. Why then won't the CancelButton
work?
 

Thirdly, I wanted to set a hotkey for the Delete button. So I changed the
line, to read:
 FileList.DefaultButton = "&Amp;Delete"
. Again, I thought I did what the example in the docs tells me to do. But
now, soon as I try to run the app, I get an error thrown at me. Much
fombling proved to me, that if I did the AMP all in lower-case, the
shortcuts work with no error. But if I capitalize any of the A, M or P,
there is the error. Shouldn't the code of the Toolkit be non-case sensitive?
Just wonder, since all other app developing I have been doing, has been
non-sensitive to the casing.
 
If any of you can tell me why the CancelButton does throw an error on me, no
matter what I try, I will be extremely thankful. And, if you happen to have
an answer for the rest of my trouble, here is the ears. Smile.
 
 
 

 

Reply via email to