UpDown->Tab Behavior

The place for threads about TimoSoft EditControls.
Post Reply
User avatar
Mex
Captain
Posts: 130
Joined: 24 Sep 2009, 19:47

UpDown->Tab Behavior

Post by Mex »

Hi

Is following behavior possible with yor TextBox (Like MSForms TextBox)

1) TextBox with Multiline enabled

Lets say there are 5 lines text in textbox.
Cursor is on first line, user presses Down key on keyboard, cursor is moved to the next line.
When curos is on the last line and user presses Down, focus is sent to the next control (Like Tab)

BR;
Meelis
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Re: UpDown->Tab Behavior

Post by TiKu »

There is no such built-in feature, but you can use the KeyDown event, the GetSelection method, the GetLineFromChar method and the GetLineCount method to check whether the cursor is in the last line. Then you should be able to fake a Tab key press using SendKeys or keybd_event or SendInput.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
User avatar
Mex
Captain
Posts: 130
Joined: 24 Sep 2009, 19:47

Re: UpDown->Tab Behavior

Post by Mex »

Hi Timo

Ok i found a solution.
Im using SendMessage APi and EM_LINEFROMCHAR message to find current line and then i set focus to previous or next textbox, when cursor is on last or first line.

What im also missing is Locked property like in MSForms TextBox.

One more thing i noticed - i think its not a bug but it works with MSForms controls.

Lets say i have 5 textboxes on PictureBox.
With MSForms controls when you press Tab key, focus is set to the next control. When last control is in focus then Tab press has no effect(goes not outside container)
but with your TextBox it goes outside the container.

Alles gute;
Meelis
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Re: UpDown->Tab Behavior

Post by TiKu »

Mex wrote:Ok i found a solution.
Im using SendMessage APi and EM_LINEFROMCHAR message to find current line and then i set focus to previous or next textbox, when cursor is on last or first line.
So you are doing the same as I suggested in my previous post, but using the API. Internally, the TextBox methods that I mentioned also use SendMessage and EM_LINEFROMCHAR and so on.
Mex wrote:What im also missing is Locked property like in MSForms TextBox.
What does it do? I don't have any MS Office product, so I don't have MS Forms 2.0 to look it up myself. There's a ReadOnly property, maybe this is what you're looking for.
Mex wrote:One more thing i noticed - i think its not a bug but it works with MSForms controls.

Lets say i have 5 textboxes on PictureBox.
With MSForms controls when you press Tab key, focus is set to the next control. When last control is in focus then Tab press has no effect(goes not outside container)
but with your TextBox it goes outside the container.
I would call this a bug of MS Forms controls. The normal behavior of ActiveX controls is that the focus can go outside the container.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
User avatar
Mex
Captain
Posts: 130
Joined: 24 Sep 2009, 19:47

Re: UpDown->Tab Behavior

Post by Mex »

Hi

U can download http://www.deltmar.ee/riks/download/setuppad.exe
Microsoft ActiveX Control Pad, this setup contains MSForms controls.

Meelis
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Re: UpDown->Tab Behavior

Post by TiKu »

It can't be installed on Windows 7 64 Bit.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Post Reply