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++ Library : Other (not classified elsewhere) » How to catch and overwrite child control event?
Re: How to catch and overwrite child control event? [message #13674 is a reply to message #13673] Mon, 21 January 2008 02:00 Go to previous messageGo to previous message
Oblivion is currently offline  Oblivion
Messages: 1094
Registered: August 2007
Senior Contributor
One more general (maybe application wide) way is to use a "keyhook".
I assume you derive your class from Ctrl or a Ctrl derived class (as usual in U++):

Define a KeyHook.

Below is the code of a key hook for intercepting Ctrl+Home key:


class foo : public Ctrl
{
// some other declarations...
// some other declarations...
 
	static bool CtrlKeyHook(Ctrl* ctrl, dword key, int count)	{ if(key == K_CTRL_HOME && ctrl == &myctrl) // here goes the intercepting function or method... // ; return true; }
}


As You can see in the above declaration, you can identify the "Ctrl" which sends the message too.

in the class implementation:
foo::foo()
{
	InstallKeyHook(&foo::CtrlKeyHook);
}

foo::~foo()
{
	DeinstallKeyHook(&foo::CtrlKeyHook);
}



(Two things: don't forget to return true (and dont forget to "Deinstall" hook...)

You can find more info about other hook types (mouse, state) in CtrlCore/Src/Ctrl section of the Help Topics of TheIDE Wink

Ps: I don't know why your code didn't work (I should work), but I uploaded a Key() virtual function version below. I Hope It'll help...
  • Attachment: KeyTest.rar
    (Size: 0.83KB, Downloaded 307 times)


[Updated on: Mon, 21 January 2008 02:21]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: BUG in UVS2 2384 release
Next Topic: Bug in UVS2 2399 release
Goto Forum:
  


Current Time: Mon May 13 00:19:00 CEST 2024

Total time taken to generate the page: 0.01421 seconds