Home » U++ Library support » U++ Widgets - General questions or Mixed problems » Using InstallKeyHook
Using InstallKeyHook [message #10378] |
Wed, 04 July 2007 19:27  |
malaugh
Messages: 7 Registered: June 2007
|
Promising Member |
|
|
I am trying to disable an entry field if the user types in another entry field. If the user enters data in the EditVakue control editVendData, then the EditValue control editVendLength, should be disabled. I thought I could do this with the Installkeyhook function. My basic logic is
1) Capture the key input for the application
2) In the key handler, if a key is hit when the user is in the editVendData, then disable editVendLength.
I have tried numerous methods, this is one of my attempts.
In the class
friend bool VendDataKeyHook(Ctrl *ctrl, dword key, int count);
In the constructor
InstallKeyHook(VendDataKeyHook);
The function
bool VendDataKeyHook(Ctrl *ctrl, dword key, int count)
{
USBConsole *panel = (USBConsole *)ctrl;
if(ctrl->GetFocusCtrl() == (Ctrl *)(&(panel->editVendData)))
{
panel->editVendLength.Disable();
}
return(FALSE);
}
The if statement is always FALSE, so editVendLength is never disabled. Also if I move the disable statement outside the if, the program crashes. What am I doing wrong?
I could not find any examples that use InstallKeyHook, is there one?
|
|
|
Goto Forum:
Current Time: Tue Apr 29 03:21:51 CEST 2025
Total time taken to generate the page: 0.00846 seconds
|