U++ framework
Do not panic. Ask here before giving up.

Home » U++ Library support » U++ Widgets - General questions or Mixed problems » why the ctrl does`t have HWND?
Re: why the ctrl does`t have HWND? [message #46399 is a reply to message #46398] Thu, 05 May 2016 04:56 Go to previous messageGo to previous message
Lance is currently offline  Lance
Messages: 656
Registered: March 2007
Contributor
Still very primitive, but you can get some idea.

Not all State (reason) needs to be taken care of. Seems it's fine if you only do the POSITION case.

Flicks, flicks, flicks. Let's see if somebody can make it smoother.

#include <CtrlLib/CtrlLib.h>

using namespace Upp;

class MyPopup : public Ctrl
{
public:
	virtual void Paint(Draw& w)
	{
		w.DrawText(10,20,String().Cat()<<"Daw in the faked Ctrl,"
		 " my HWND is"<<GetHWND(),StdFont(),White());
		 
	}
};

class PopupHolder : public Ctrl
{
public:

	void Reset()
	{
		if(!GetTopCtrl())
			return;
		popup.Close();
		popup.SetRect( GetRect() + this->GetTopCtrl()->GetScreenRect().TopLeft() );
		popup.PopUp(this,true,false);
	}

	virtual void State(int reason)
	{
		switch(reason)
		{
		
		//	FOCUS      = 10,
		case ACTIVATE: //   = 11,
			LOG("ACTIVATE");
			Reset();
			break;
		case DEACTIVATE:// = 12,
			LOG("DEACTIVATE");
			popup.Close();
			break;
		case SHOW://       = 13,
			LOG("SHOW");
			Reset();
			break;
	//	ENABLE     = 14,
	//	EDITABLE   = 15,
		case OPEN://       = 16,
			LOG("OPEN");
			Reset();
			break;
		case CLOSE://      = 17,
			LOG("CLOSE");
			popup.Close();
			break;
		case POSITION://   = 100,
			LOG("Position");
			Reset();
			break;
		case LAYOUTPOS://  = 101,
			LOG("LAYOUTPOS");
			Reset();
			break;
		}
	}
	
	MyPopup popup;
};
struct MyApp: public TopWindow
{
	MyApp()
	{
		//Add(e.LeftPos(30,600).TopPos(40,400));
		Add(h.SizePos());
	}
	PopupHolder h;
	
	
	typedef MyApp CLASSNAME;
};

GUI_APP_MAIN
{
	MyApp().MinimizeBox().MaximizeBox().Sizeable().Run();
	
}

[Updated on: Thu, 05 May 2016 04:59]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: DropList color is the same when editable or not
Next Topic: ColumnList clipping problem
Goto Forum:
  


Current Time: Thu Jul 16 15:03:30 GMT+2 2026

Total time taken to generate the page: 0.00500 seconds