LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

scrolling so complete text box lines are always displayed

When designing a text box, you can define the number of visible lines displayed.
 
However, I notice that I can scroll and stop so only a partial line is displayed at the top of a window.
 
This is normally not a big deal but when I'm trying to align a second text box based on the line number of the first, the alignment will be off.
 
The optimal solution would be to tell the text box control that it can only display whole line numbers, not partial.
 
I have a timer routine which is constantly running and synchronizing the two text boxes. I tried the following code to re-sync the first text box to a visible line (prior to syncing the second text box) but that doesn't work as expected...
 
GetCtrlAttribute(panel_handle, textbox1 ,ATTR_FIRST_VISIBLE_LINE, &firstLine);
SetCtrlAttribute(panel_handle, textbox1, ATTR_FIRST_VISIBLE_LINE, firstLine);
0 Kudos
Message 1 of 2
(3,086 Views)
The problem is that as you drag the scroll bar, no events are generated, and ATTR_FIRST_VISIBLE_LINE is not updated.

You could try using the Scroll Bar custom control, as described by Luis in this thread. This approach should work equally well for a Textbox.

Let us know how you go.

Regards,
Colin.

Message Edited by cdk52 on 08-01-2006 01:08 PM

0 Kudos
Message 2 of 2
(3,065 Views)