I could suggest you to use list boxes instead of text boxes. In a list box,
clicking an item highlits its entire line automatically with no need for
tricks.
If you need to determine the row you clicked on, you must use
EVENT_RIGHT_CLICK or EVENT_LEFT_CLICK events which hold in eventData1 and
eventData2 the absolute mouse position in pixel relative to panel. To
determine the row clicked on, for example, use the following code:
case EVENT_RIGHT_CLICK:
GetCtrlAttribute (panel, control, ATTR_TOP, &top); // Absolute
vertical mouse position
top = eventData1 - top; // Mouse position
relative to the control
GetCtrlAttribute (panel, control, ATTR_TEXT_POINT_SIZE, &textsize);
idx = top / 15;
// Mouse
position expressed in rows of text
GetNumListItems (panel, control, &items);
if (idx >= items) return 0; // Mouse outside the
written area of the list box
SetCtrlIndex (panel, control, idx); // Highlight the row
(EVENT_RIGHT_CLICK doesn't)
Hope that help
Roberto
Ralph wrote in message 39b7a698@newsgroups.ni.com...
>
> Could somebody please explain how to code a text
> box feature that allows you to click-highlight an
> entire line of text in a text box ??
>
> For example, all of the CVI library panels display
> lists of functions - one click highlights the function
> name and its descriptive name.
>
> How do you take a mouse click (in pixels)
> convert to a line number then highlight
> the characters (in bytes) within the
> text box. Neat trick, its been done nicely
> but whats the best way to do this ??
>
> Any help would be appreciated!
> Thanks,
> Ralph Stickley