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 » Extra libraries, Code snippets, applications etc. » U++ users applications in progress and useful code snippets, including reference examples! » Problems with the position of buttons
Problems with the position of buttons [message #3556] Thu, 01 June 2006 17:05 Go to next message
_Seven_ is currently offline  _Seven_
Messages: 35
Registered: April 2006
Member
Hi. I want put a button in the right-buttom of the window but it doesn't work. I follow the examples on the web page but it continues not to work. Here is the code
#include <CtrlLib/CtrlLib.h>

struct App : public TopWindow{
	bool list_numbers;
	Button botao_sair;
	
	void Click(){
		PromptOK("O programa vai ser encerrado!");
		Exit();
	}
	virtual void Paint(Draw& w) {
        w.DrawRect(GetSize(), SBlack);
        w.DrawText(20, 20, "Isto ainda nao esta como eu quero!!!!", Arial(22), White);
    }
	void Exit(){
		Close();
	}
	void List_Numbers(){
		list_numbers=!list_numbers;
	}
	void show(int i){
		PromptOK(AsString(i));
	}
	void draw(Bar& bar){
		for(int i=0;i<10;i++)
			bar.Add(AsString(i), THISBACK1(show,i));
	}
	void opcoes(Bar& bar){
		bar.Add("Mostrar numeros", THISBACK(List_Numbers))
		   .Check(list_numbers);
		if(list_numbers==true)
			bar.Add("Lista :", THISBACK(draw));
		bar.Add("Sair", THISBACK(Exit)).Key(K_CTRL_Q);
	}
	void Menu1(Bar& bar){
		bar.Add("Opcoes",THISBACK(opcoes));
	}
		
	MenuBar Opcoes;
	
	typedef App CLASSNAME;
	
	App(){
        list_numbers = false;
Add(botao_sair.RightPos(10, 100).BottomPos(10,20));//HERE!!!!
        botao_sair.SetLabel("Sair");
        AddFrame(Opcoes);
        Opcoes.Set(THISBACK(Menu1));
        botao_sair<<=THISBACK(Click);
    }
};

GUI_APP_MAIN
{
	//App().SetRect(0,0,50,50);
    App().Title("My first GUI").Sizeable().Run();
    
}


Well i think that i don't understand how .LeftPos(), TopPos(), RightPos() and BottomPos() work. If you can explain me and see why this happen in my code i will be thankful.
Thanks all.

[Updated on: Thu, 01 June 2006 17:05]

Report message to a moderator

Re: Problems with the position of buttons [message #3557 is a reply to message #3556] Thu, 01 June 2006 18:40 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1182
Registered: March 2006
Location: Italy
Senior Contributor
_Seven_ wrote on Thu, 01 June 2006 17:05

Hi. I want put a button in the right-buttom of the window but it doesn't work.

I've run your code and I got a button in the right-bottom side of the window. It seems to work. Why you say it doesn't work, what do you want to achieve?

Luigi
index.php?t=getfile&id=157&private=0
  • Attachment: v5_9.jpg
    (Size: 2.64KB, Downloaded 2239 times)

[Updated on: Thu, 01 June 2006 18:42]

Report message to a moderator

Re: Problems with the position of buttons [message #3563 is a reply to message #3556] Thu, 01 June 2006 19:13 Go to previous message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
_Seven_ wrote on Thu, 01 June 2006 16:05



Well i think that i don't understand how .LeftPos(), TopPos(), RightPos() and BottomPos() work. If you can explain me and see why this happen in my code i will be thankful.
Thanks all.


What if you try to imagine PosFromLeft, PosFromRight etc...? It helps for me...
Previous Topic: Newbie Problems with the menu example...
Next Topic: ColorDialog - a free model application
Goto Forum:
  


Current Time: Thu Mar 28 21:33:41 CET 2024

Total time taken to generate the page: 0.01090 seconds