| |

VerySource

 Forgot password?
 Register
Search
View: 848|Reply: 4

ComboBoxEx1 focus shift issue

[Copy link]

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-1-9 21:00:01
| Show all posts |Read mode
Want to shift the focus with Enter, write in OnKeydown of ComboBoxEx1:

 if key = 13 then
 SendMessage (Handle, WM_NEXTDLGCTL, 0,0);
It is found that the focus cannot be transferred, and other methods can be used.
Reply

Use magic Report

0

Threads

40

Posts

27.00

Credits

Newbie

Rank: 1

Credits
27.00

 China

Post time: 2020-1-13 18:45:01
| Show all posts
First, declare the following private procedure in the main form:

{------}
procedure TMainForm.DoEnterAsTab (var Msg: TMsg; var Handled: Boolean);
begin
  if Msg.Message = WM_KEYDOWN then
  begin
    if Msg.wParam = VK_RETURN then
      Keybd_event (VK_TAB, 0, 0, 0);
  end; // if
end;
{------}
    Add in the OnCreate event of the main form:

{------}
  Application.OnMessage: = DoEnterAsTab;
{------}
    During the running of the program, WM_KEYDOWN information is continuously received. If the key pressed is VK_RETURN (# 13), we simulate a keyboard event and pass VK_TAB as a parameter. Works throughout the program.
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-1-31 16:36:02
| Show all posts
It doesn't seem so complicated, I've done it myself.
SendMessage (Handle, WM_NEXTDLGCTL, 0,0); changed to
PostMessage (Handle, WM_NEXTDLGCTL, 0,0);
Reply

Use magic Report

0

Threads

5

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-2-10 16:00:01
| Show all posts
Congratulations!
Reply

Use magic Report

0

Threads

17

Posts

16.00

Credits

Newbie

Rank: 1

Credits
16.00

 China

Post time: 2020-2-11 17:30:01
| Show all posts
top
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list