Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Widgets - General questions or Mixed problems » Using InstallKeyHook
Using InstallKeyHook [message #10378] Wed, 04 July 2007 19:27 Go to previous message
malaugh is currently offline  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?
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Enter turns WithDropChoice(LineEdit) into chaos
Next Topic: Refresh(), Paint(Draw& w), or something else nearby?
Goto Forum:
  


Current Time: Sat May 18 23:13:38 CEST 2024

Total time taken to generate the page: 0.02365 seconds