| Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next 1 | 1. Retrieve mouse position #12926 Posted by: PeterJ 2009-05-22 21:07:54 Last edited by: PeterJ 2009-05-22 21:10:37 (Total edited 3 times) | I have a View definition like this:
in which I place a table:
ERROR = guiaddctl("VIEW 4, 19, 347, 184, REPORT|SINGLE|SHARE|EDIT|BORDER, , MyView")
DO i = 1 TO 2
mycolumn.!width = 50
SELECT i
WHEN 1 THEN mycolumn.!text = "Column 1"
WHEN 2 THEN mycolumn.!text = "Column 2"
END
mycolumn.!state = "LEFT"
mycolumn.!subitem = i
guiaddctltext("MyView", "MyColumn", 1)
END
and eventually fill it up with several entries in both columns. I would like to select single entries, either in column 1 or 2. The event handling allows me only to retrieve the line which has been selected, not the items (either col 1 or 2). I wonder if there is a way to read the mouse pointer where the selection took place. I could then map it either to column 1 or 2 myself. I played already with the mouse move event, but it does not react in a way which is useful, is there any other way to pick it up?
Peter | 2. #12946 | Just for the "Reginald Answer Guy", there's a new REXX GUI update that will do what you need. Download that new version of the add-on dll.
Also download the new version of the example script "view.rex". It shows how to handle a click on an item. When you click on an item, it pops up a message box telling which item number, and column number (within that item) you've clicked on. Try clicking the left or the right button (and notice you can differentiate between left and right with two separate CLICK and RCLICK handlers).
In a nutshell: After you GuiCreateWindow() with your view control, you then send your view control a "SETEXTENDEDLISTVIEWSTYLE" message (by calling GuiSendMsg). The third arg is a list of all the "features" you want to change for your view control. For example, if you want to change the "CLICK" feature (ie, the ability to receive a CLICK event when you click on an item), then you'll pass "CLICK". If you want to change both the "CLICK" and "FULLROW" features, then you'll pass "CLICK | FULLROW". (ie, Each feature name is separated by a | character). Then for the fourth arg to GuiSendMsg(), you pass the actual features you want to enable. (If you pass a feature name in the third arg, but not in the fourth arg, then the feature is turned off).
For example, assume the variable "MyView" is associated with your view control:
guisendmsg("MyView", "SETEXTENDEDLISTVIEWSTYLE", "CLICK|FULLROW", "CLICK|FULLROW")
guisendmsg("MyView", "SETEXTENDEDLISTVIEWSTYLE", "FULLROW")
guisendmsg("MyView", "SETEXTENDEDLISTVIEWSTYLE", "CLICK|FULLROW", "CLICK") Of course, you'll want to put an event handler for that "CLICK" event on your view control:wm_click_myview:
guisay("Clicked on column" myview "of item" myview.1)
RETURN Here are some features that may be useful to you:
"CLICK" tells the view control to cause a "CLICK" event when the user clicks the left mouse button upon an item, or a "RCLICK" event when the user clicks the right mouse button. The variable name associated with the control is set to the column number clicked upon. The variable name with a .1 tail is set to the item number clicked upon.
"DBLCLK" is like "CLICK" except the user must double-click on an item, and a "DBLCLK" or "RDBLCLK" event happens (depending upon which mouse button is double-clicked). Variables are set per "CLICK".
"FULLROW" makes the selected item highlighted across the full row (ie, all columns instead of only the first column).
"CHECKBOX" adds checkboxes to the items. "AUTOCHECK" sets the checkbox when the user single-clicks on an item.
"FLAT" shows the scroll bar as flat.
"AUTOCOLUMNS" automatically sizes a column to fit its text. (Vista only).
"BORDER" changes border color whan an item is selected, instead of highlighting the item.
"MINSNAP" snaps a column to a minimum size when user resizes it. (Vista only).
"GRID" displays grid lines around items/columns.
"TRACK" enables hot-track selection. Hot track selection means that an item is automatically selected when the cursor remains over the item for a certain period of time. | 3. #12950 Posted by: PeterJ 2009-05-26 04:07:35 | Thanks a lot Jeff, I appreciate your effort! It works perfectly fine! | Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next 1 |
|
|