Karen,

Uncheck the "Hide Selected" option for the listview.
That way, if the list does not have focus, you will see the selected row grayed.

Dennis McGrath
________________________________________
From: [email protected] [[email protected]] On Behalf Of [email protected] 
[[email protected]]
Sent: Thursday, June 02, 2011 7:41 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Some examples of List View "makeclick" code

Buddy:  I had sent this email yesterday and don't think I saw it come through 
either...  I'll do a resend and see if it shows up!


I had my first opportunity to use "makeclick" to show a list view item as 
already selected, and I took a bunch of wrong turns along the way. It works 
great now, but in case anyone wants to save these notes for the future... I 
know I saved this once I had it working!

The form
I have a complicated search form with a bunch of user criteria fields, and a 
variable lookup list view that is populated when they click "search". When the 
search form first comes up, the list view is blank and focus is on the first 
user criteria field. If they double-click on an item in the list view, I close 
the search form and bring up that item's form. On that item's form, they can 
either exit altogether or "return to search". What they asked for was that if 
they "return to search", that the row they clicked be highlighted. Sounds 
simple enough...

EEP on double-click of the list view
I trap the item clicked as follows:

SET VAR vItemPicked INTEGER = NULL, vText TEXT = NULL
GETPROPERTY listview ITEMINDEX vText
SET VAR vItemPicked = (INT(.vText))
-- Now the eep goes on to closing the search form and returning to program code 
that will bring up the individual edit form

EEP on "form on after start" of the search form
This was the tricky part to get to work. There were 2 problems that I needed to 
solve.
(1) The first try of code worked to highlight the row but then the highlight 
immediately disappeared. I finally realized it was because the focus was on 
that user field, not on the list view anymore. I do wish we could have "sticky" 
list view highlights.
(2) Even with the focus figured out, for some reason I could not use a variable 
in my "property" command, so I had to build the command.

So this works nicely:

SET VAR vItemPicked INT
IF vItemPicked IS NOT NULL THEN
    PROPERTY listview SET_FOCUS 'TRUE'
    SET VAR vCommand = ('PROPERTY listview MAKECLICK' &CTXT(.vItemPicked) )
    &vCommand
ENDIF

Karen


Reply via email to