last-event:x and pop-up menus

adisney

New Member
I have a dynamic browser where all columns are read-only. It shows the schedule for a doctor's office, with different columns representing different doctors. The rows represent timeslots (e.g. 9:00, 9:10, 9:20, etc.)

Associated with the browser I have a pop-up menu. Certain menu options need to be sensitive or not, depending on whether there is an appointment scheduled for the timeslot/doctor. I can easily tell which timeslot I'm in by looking at the current temp-table record. However, I can't tell which doctor (column) the user clicked on. In a similar situation (user double-clicking to get further information) I was able to figure it out by using last-event:x, which is ugly, but works. However, when I look at last-event:x in the menu-drop trigger, the value is "?".

Any ideas on how to figure out which column the user clicked on, or another way to solve this problem?

Thanks,
Anne
 
a solution

With help (from John Campbell) I have the following solution:

Make a mouse-menu-down trigger for the browse, which contains the following code:

holdCol = last-event:column. /* holdCol is a procedure-level variable */

Then, make a menu-drop trigger (for the popup menu), which runs code like this:

define variable hColumn as handle.
define variable cntr as i.
/* hCurrBrowse is a handle to the browse */

do cntr = hCurrBrowse:num-columns to 1 by -1:
hColumn = hCurrBrowse:get-browse-column(cntr) no-error.
if holdCol > hColumn:column then leave.
end.


This gives the current browse column, the row is already known, so I can tell what cell the user clicked in, and use its data to make the pop-up menu options sensitive or not.
 
Back
Top