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 » TopWindow&PopUp, TrayIcon » How do you use PopUp
How do you use PopUp [message #2942] Mon, 01 May 2006 09:57 Go to next message
gprentice is currently offline  gprentice
Messages: 260
Registered: November 2005
Location: New Zealand
Experienced Member

Is there a simple example of how to use PopUp?

The following doesn't work - nothing happens when the left mouse button is clicked. My efforts prior to this upset my operating system, requiring the help of task manager...


struct MyAppWindow : TopWindow {
    Point  p;
    Ctrl c1;
    Button button;
    virtual void LeftDown(Point pos, dword flags) {
		c1.Add(button.SetLabel("Button").LeftPosZ(10, 64).TopPosZ(10, 24));
        c1.PopUp(this,false,true,false,true);
        p = pos;
        Refresh();
    }


Thanks
Graeme
Re: How do you use PopUp [message #2945 is a reply to message #2942] Mon, 01 May 2006 10:00 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13986
Registered: November 2005
Ultimate Member
gprentice wrote on Mon, 01 May 2006 03:57


Is there a simple example of how to use PopUp?

The following doesn't work - nothing happens when the left mouse button is clicked. My efforts prior to this upset my operating system, requiring the help of task manager...


struct MyAppWindow : TopWindow {
    Point  p;
    Ctrl c1;
    Button button;
    virtual void LeftDown(Point pos, dword flags) {
		c1.Add(button.SetLabel("Button").LeftPosZ(10, 64).TopPosZ(10, 24));
        c1.PopUp(this,false,true,false,true);
        p = pos;
        Refresh();
    }


Thanks
Graeme



I believe the problem is that you need c1.SetRect(....

Mirek
Re: How do you use PopUp [message #2951 is a reply to message #2945] Mon, 01 May 2006 11:31 Go to previous messageGo to next message
gprentice is currently offline  gprentice
Messages: 260
Registered: November 2005
Location: New Zealand
Experienced Member
luzr wrote on Mon, 01 May 2006 20:00


I believe the problem is that you need c1.SetRect(....

Mirek




Hmmm. I was missing a few other things too - thanks.

Having popped up a popup window, how do I close it?
This doesn't work -

struct MyAppWindow : TopWindow {
	typedef MyAppWindow CLASSNAME;
    Point  p;
    String text;
    //StaticRect s1;
    StaticRect c1;
    Button button;
    virtual void LeftDown(Point pos, dword flags) {
		c1.SetRect(20,30,40,50);
		c1.Add(button.SetLabel("Button").LeftPosZ(10, 64).TopPosZ(10, 24));
        c1.PopUp(this,false,true,false,true);
        p = pos;
        Refresh();
    }

    virtual void MouseMove(Point pos, dword flags) {
        text = Format("[%d:%d]", pos.x, pos.y);
        Refresh();
    }

    virtual void Paint(Draw& w) {
        w.DrawRect(GetSize(), SWhite);
        w.DrawText(p.x, p.y, text, Arial(20), Magenta);
    }

	void finish()
	{
	    c1.Close();
	}
	
    MyAppWindow() {
          p.x = p.y = 0;
        Add(c1.SetPos(c1.PosLeft(5, 15), c1.PosTop(20, 5)));
        button <<= THISBACK(finish);
    }
};


Maybe there should be a PopUp example.
BTW - PopUp doesn't give me an option of always-on-top (topmost is not the same as always-on-top). Is always on top possible with PopUp?

Graeme
Re: How do you use PopUp [message #2955 is a reply to message #2951] Mon, 01 May 2006 13:15 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
For a popup example, I guess, it would be helpful to spy ide/Assist.cpp. Smile "PopUpAssist"... etc.

[Updated on: Mon, 01 May 2006 14:21]

Report message to a moderator

Re: How do you use PopUp [message #2959 is a reply to message #2951] Mon, 01 May 2006 14:18 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13986
Registered: November 2005
Ultimate Member
    MyAppWindow() {
          p.x = p.y = 0;
        Add(c1.SetPos(c1.PosLeft(5, 15), c1.PosTop(20, 5)));


You cannot have your PopUp at the same time to be a child.

This works (more or less, just your code with that Add removed):

#include <CtrlLib/CtrlLib.h>

struct MyAppWindow : TopWindow {
	typedef MyAppWindow CLASSNAME;
    Point  p;
    String text;
    //StaticRect s1;
    StaticRect c1;
    Button button;
    virtual void LeftDown(Point pos, dword flags) {
		c1.SetRect(20,30,80,50);
		c1.Add(button.SetLabel("Button").LeftPosZ(10, 64).TopPosZ(10, 24));
        c1.PopUp(this,false,true,false,true);
        p = pos;
        Refresh();
    }

    virtual void MouseMove(Point pos, dword flags) {
        text = Format("[%d:%d]", pos.x, pos.y);
        Refresh();
    }

    virtual void Paint(Draw& w) {
        w.DrawRect(GetSize(), SWhite);
        w.DrawText(p.x, p.y, text, Arial(20), Magenta);
    }

	void finish()
	{
	    c1.Close();
	}
	
	MyAppWindow() {
		p.x = p.y = 0;
		button <<= THISBACK(finish);
    }
};

GUI_APP_MAIN
{
	MyAppWindow w;
	w.Run();
}


Mirek

Re: How do you use PopUp [message #2962 is a reply to message #2955] Mon, 01 May 2006 19:02 Go to previous messageGo to next message
gprentice is currently offline  gprentice
Messages: 260
Registered: November 2005
Location: New Zealand
Experienced Member
fudadmin wrote on Mon, 01 May 2006 23:15

For a popup example, I guess, it would be helpful to spy ide/Assist.cpp. Smile "PopUpAssist"... etc.



I already did that. It wasn't any help at all actually.

Re: How do you use PopUp [message #2963 is a reply to message #2959] Mon, 01 May 2006 19:04 Go to previous message
gprentice is currently offline  gprentice
Messages: 260
Registered: November 2005
Location: New Zealand
Experienced Member

Quote:


You cannot have your PopUp at the same time to be a child.

This works (more or less, just your code with that Add removed):


Thanks.
Previous Topic: One Main TopWindow and several others TopWindows, how? [SOLVED...]
Next Topic: Splash Screen
Goto Forum:
  


Current Time: Tue Jun 25 19:40:07 CEST 2024

Total time taken to generate the page: 0.01583 seconds