Terry,
With some help of others I got it.
The following works great!
Listbox1.ListIndex = -1
SetFocus()
Thanks for all your help.
Jonathon
----- Original Message -----
From: "Terry Ford" <[EMAIL PROTECTED]>
To: "REALbasic NUG" <[email protected]>
Sent: Monday, May 08, 2006 6:15 PM
Subject: Re: Clearing the focus on a Listbox
On May 8, 2006, at 6:28 AM, Jonathon Bevar wrote:
Terry,
Now you lost me, you said that:
"Listbox.ListIndex=-1 will clear any/all selected row(s) if that
is what you are referring to."
Ok, then you said
"Sure of taking the highlighted or selected status off. This won't
clear the focus of the listbox however which appears to be the
subject. ;-)"
"(Self.)SetFocus or selecting another control that can accept the
focus will do that."
Ok with this now, how do I code it to make it work?
Just do a [self.setfocus] in the section where I want to clear and
unsetfocus to the listbox?
On May 8, 2006, at 6:55 AM, Jonathon Bevar wrote:
I did try Terry's idea and yes it works perfectly. But when I do
an arrow up-down it will trigger the setfocus in the list box were
as I want NO response at all. The end user must click on the
selection, or am I being to picky?
It sounds to me that there are still some facts missing here.
If the listbox has the focus, the up and down arrows automatically
navigate up and down the list. This will happen if you set the
ListIndex to -1 to unselect any row but will immediately select the
first row if you press the down arrow key.
If you wish this to NOT happen then you COULD trap those keys in the
keydown event of the listbox.
Select Case asc(Key)
Case 30,31
Return True
End Select
None of this has anything to do with the focus which can be set to
the window itself by Self.SetFocus, SetFocus if the parent is a
window or ClearFocus can be also be used. This will disable the arrow
keys as the listbox no longer will have the focus but will not clear
the selection in the Listbox itself. It will simply gray it out.
What I think you want is a combination of two items in the code that
clears the other items. This will still allow navigation when the
listbox has the focus if you so desire.
Listbox1.ListIndex = -1
ClearFocus (or SetFocus)
One or more of these ideas should work for what you have described so
far.
Terry
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.5.5/333 - Release Date: 5/5/2006
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.5.5/333 - Release Date: 5/5/2006
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>