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 » Community » Newbie corner » Function key to Button
Function key to Button [message #54349] Thu, 02 July 2020 05:51 Go to next message
Shwetha is currently offline  Shwetha
Messages: 39
Registered: August 2011
Member
Hi,

How to assign function key to button which is on the sub layouts

ie, for example in ScatterCtrlDemo we have tabctrls.

In Tab5Dynamic I need to invoke button action start, stop with fn keys..

please guide.

Thank you.
Re: Function key to Button [message #54351 is a reply to message #54349] Thu, 02 July 2020 22:18 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3377
Registered: August 2008
Senior Veteran
Hi Shwetha

You can capture virtual bool Key(), handle the key, and then call the parent window to handle the keys that your function doesn't. For example:
bool BtnTest::Key(dword key, int val) {
    if(key == K_CTRL_S) {
        btnEnter.DoAction();
        return true;
    } else
        return TopWindow::Key(key, val);
}


Best regards
Iñaki
Re: Function key to Button [message #54352 is a reply to message #54351] Fri, 03 July 2020 06:52 Go to previous messageGo to next message
Shwetha is currently offline  Shwetha
Messages: 39
Registered: August 2011
Member
Hi kuldo,

still not clear.

I get the following error :

cannot call member function 'virtual bool Upp::TopWindow::Key(Upp::dword, int)' without object


bool Tab5_Dynamic::Key(dword key, int val)

{
	LOG("key");
	DUMP("KeyAction");
	
  if(key == K_CTRL_S) {
        bStart.Action();
        return true;
    } else
        return TopWindow::Key(key, val);
}
Re: Function key to Button [message #54356 is a reply to message #54352] Fri, 03 July 2020 10:41 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1096
Registered: August 2007
Senior Contributor
Hello Shwetha,

Quote:
still not clear.

I get the following error :

cannot call member function 'virtual bool Upp::TopWindow::Key(Upp::dword, int)' without object


Koldo has shown the correct generic way: If your derived class is based on TopWindow, it will work. But in your specific example, the button is called froım Tab5_Dynamic class, which is derived from ScatterDemo. So you should call ScatterDemo::Key (or any other base class that derives from Upp::Ctrl, thati s suitable), if you need to further process ScatterDemo keys (you'll probably need that in the future.)

Try this instead:

bool Tab5_Dynamic::Key(dword key, int val)

{
	LOG("key");
	DUMP("KeyAction");
	
  if(key == K_CTRL_S) {
        bStart.Action();
        return true;
    } else
        return ScatterDemo::Key(key, val); 
}




Best regards,
Oblivion


[Updated on: Fri, 03 July 2020 11:50]

Report message to a moderator

Re: Function key to Button [message #54365 is a reply to message #54356] Tue, 07 July 2020 06:40 Go to previous message
Shwetha is currently offline  Shwetha
Messages: 39
Registered: August 2011
Member
Hi Oblivion ,

yes true that. I need to define ScatterDemo keys instead Topwindow.
I shall try! Thank You.
Previous Topic: Ultimate++ i.r.t. Fossil SCM
Next Topic: build UMK from SVN repository on windows
Goto Forum:
  


Current Time: Sat Jul 20 17:32:24 CEST 2024

Total time taken to generate the page: 0.02402 seconds