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! » Porting a Delphi Application
Re: Porting a Delphi Application [message #11564 is a reply to message #11545] Mon, 17 September 2007 19:40 Go to previous messageGo to previous message
cbpporter is currently offline  cbpporter
Messages: 1402
Registered: September 2007
Ultimate Contributor
luzr wrote on Mon, 17 September 2007 10:03


Usual custom here, when you post some sources like this, is to use package and perhaps provide another one as demonstration - that way downloaders can just unpack to some package nest, start theide, choose the test and run it.

This is not a complaint, just a note - I guess it is time to write U++ netiquette summmary Smile



I will post another improved version (current one gives error when trying to use it as base for a template layout because it misses a SetRect function with a Rect parameter) once it is ready and I'll try to have a proper package format. Previous post was only so people get an idea of what I'm trying to do (and if can be done easier point me in the right direction).

But I have a functional (barely) DropPane and now I'm trying to insert inside an array of 2x4 ToolButtons (I'm not using button because I need them to be flat-looking), like in the attached picture.
index.php?t=getfile&id=719&private=0
Layout and positioning is very important, so I did not use a ToolBar component, instead I hand placed all the buttons. I also need them to check when the user click on them. I managed to do this, but unfortunately I had to use pointers (old habits die hard). I wonder if there is a better way to do this in a U++ style?

layout
LAYOUT(ToolsLayout, 60, 200)
	ITEM(ToolButton, btnMove, LeftPosZ(8, 22).TopPosZ(24, 22))
	ITEM(ToolButton, btnEdit, LeftPosZ(30, 22).TopPosZ(24, 22))
	ITEM(ToolButton, btnLine, LeftPosZ(8, 22).TopPosZ(46, 22))
	ITEM(ToolButton, btnBezier, LeftPosZ(30, 22).TopPosZ(46, 22))
	ITEM(ToolButton, btnRectangle, LeftPosZ(8, 22).TopPosZ(68, 22))
	ITEM(ToolButton, btnEllipse, LeftPosZ(30, 22).TopPosZ(68, 22))
END_LAYOUT


code
struct ToolsDropPane: public WithToolsLayout<DropPane> {
	
	typedef ToolsDropPane CLASSNAME;
	
	ToolsDropPane();	
	
	void SetActive(ToolButton *btn);
};

ToolsDropPane::ToolsDropPane()	
{
	CtrlLayout(*this);
	
	btnMove.Image(CBPImages::Move()).Text("Modify");
	btnMove.WhenAction = THISBACK1(SetActive, &btnMove);
	btnEdit.Image(CBPImages::Edit()).Text("Edit");
	btnEdit.WhenAction = THISBACK1(SetActive, &btnEdit);
	btnLine.Image(CBPImages::Line());
	btnLine.WhenAction = THISBACK1(SetActive, &btnLine);
	btnBezier.Image(CBPImages::Bezier());
	btnBezier.WhenAction = THISBACK1(SetActive, &btnBezier);
	btnRectangle.Image(CBPImages::Rectangle()).Text("Rectangle");
	btnRectangle.WhenAction = THISBACK1(SetActive, &btnRectangle);
	btnEllipse.Image(CBPImages::Ellipse()).Text("Ellipse");
	btnEllipse.WhenAction = THISBACK1(SetActive, &btnEllipse);
	
	//btnLine.Check(true);
}

void ToolsDropPane::SetActive(ToolButton *btn)
{
	btn->Check(true);
}


On the other hand, you will notice that the third and fourth button doesn't have a Text. This is intentional. When I don't specify a text to a button inserted like this into a layout, I get a weird tool tip for it: "(Alt+Shift+address)". Does this mean anything?
  • Attachment: panel2.PNG
    (Size: 1.88KB, Downloaded 1531 times)
 
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
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
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to write a dll using Ultimate++?
Next Topic: embedded configuration data/values in self for a executable
Goto Forum:
  


Current Time: Tue Jun 11 00:14:56 CEST 2024

Total time taken to generate the page: 0.02172 seconds