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 » [solved] Widget events - any other than WhenAction ? (Trying to find equivalents of OnEnter, OnExit - in an Edit widget)
Re: Widget events - any other than WhenAction ? [message #52750 is a reply to message #52749] Sat, 16 November 2019 23:16 Go to previous messageGo to previous message
Oblivion is currently offline  Oblivion
Messages: 1094
Registered: August 2007
Senior Contributor
Hello Frank, I'm glad you find a solution to your problem.

I'd like to point out some things that may also help others, and save you from taking unnecessary steps:

1) You can edit layout files in TheIde. A layout file is nothing more than a C++ file which relies on method chaining and templates, i.e it is not "really" a macro file (of course it has macros in it but that's more for the sake of readability. Those macros expand to C++ templates.) When you open the Layout editor in TheIde, go to Edit menu and select "Edit as text" item. You can use same manu (this time the menu item will be "Edit using designer") to return to visual editing.

2) Callback macros are pre-C+11 stuff, kept for compatibility, and they are deprecated. You can use THISFN macro instead. (It does not care about the number of arguments passed to the callback, i.e there are no THISFN1, THISFN2, etc. macros to deal with. However, THISFN macro is simply a lamdba -an in-place function- wrapper. Therefore you can directly use --and I highly recommend using-- C++11 lambda functions, as they are very flexible (they can even capture local variables etc.)

E.g.

#include <CtrlLib/CtrlLib.h>

using namespace Upp;

struct App : public TopWindow {
	EditString edit;
	App()
	{
		SetRect(0, 0, 400, 200);
		Sizeable().Zoomable().Add(edit.HSizePos().VCenterPos());
		edit.WhenEnter = [=] { PromptOK((String) ~edit); };
	}
};

GUI_APP_MAIN
{
	App().Run();
}


3) MyEditDouble is "not" in the layout editor, because it doesn't have a .usc (visual representation) file at the moment. However, if you right click on the layout editor area, you'll see a menu item called "User Class" in the context menu. IF you select that item it will add a blank box, and let you set the class type (MyEditDouble) and its instance name on the left pane. Smile

I hope this helps. I suggest you check reference examples in the reference section. They really help a lot. IME, U++ is very flexible, once you're familiar with its style.

Best regards,
Oblivion


[Updated on: Sat, 16 November 2019 23:41]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: App "swallowing" mouseclicks
Next Topic: no variables in debug mode
Goto Forum:
  


Current Time: Sun May 12 03:13:12 CEST 2024

Total time taken to generate the page: 0.02132 seconds