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 previous 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

 
Read Message
Read Message
Read Message
Previous Topic: Newbie Problems with the menu example...
Next Topic: ColorDialog - a free model application
Goto Forum:
  


Current Time: Tue Apr 16 10:36:48 CEST 2024

Total time taken to generate the page: 0.02673 seconds