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 » Community » Newbie corner » Custom Control
Custom Control [message #27587] Sat, 24 July 2010 18:18 Go to next message
jeremy_c is currently offline  jeremy_c
Messages: 175
Registered: August 2007
Location: Ohio, USA
Experienced Member
Hello,

I've created a custom control and have the chicken/egg problem I think. My new control uses a layout. Thus, I have created a new layout in my main applications .lay file named DxccLayout.

I then created DxccWidget.h and DxccWidget.cpp files. The .h file currently looks like:

#ifndef _SmartLog_DxccWidget_h_
#define _SmartLog_DxccWidget_h_

class DxccWidget : public WithDxccWidgetLayout<ParentCtrl>
{
private:

public:
	typedef DxccWidget CLASSNAME;
	
	DxccWidget();
};

#endif


My main window uses this widget. So, the problem is that the layout file will not compile because it does not know about the custom control DxccWidget. When I include DxccWidget.h before the layout file, it fails to compile as it will not compile without knowing about the DxccLayout defined in the .lay file.

How is this normally handled?

Jeremy
Re: Custom Control [message #27591 is a reply to message #27587] Sun, 25 July 2010 08:52 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Hello Jeremy

I am not fully sure about your question.

If I need to include in a .lay file class a ctrl designed in another .lay file, I do this:

Imagine in Small.lay file it is designed a ctrl used in Big.lay, so, Package.h file contains:

#define LAYOUTFILE <MyProject/Small.lay>
#include <CtrlCore/lay.h>

struct SmallClass : WithSmallClass<ParentCtrl> {
	typedef SmallClass CLASSNAME;
	
	SmallClass();
	...
};

#define LAYOUTFILE <MyProject/Big.lay>
#include <CtrlCore/lay.h>

struct BigClass : WithBigClass<ParentCtrl> {
	typedef BigClass CLASSNAME;
	
	BigClass();
	...
};



Best regards
IƱaki
Re: Custom Control [message #27611 is a reply to message #27587] Sun, 25 July 2010 21:03 Go to previous message
jeremy_c is currently offline  jeremy_c
Messages: 175
Registered: August 2007
Location: Ohio, USA
Experienced Member
Thanks. I didn't realize I'd have to create different layouts, however, that's fine. Easy enough to do and decouples the control from the app a bit.

Jeremy
Previous Topic: Problem with OpenGL functionality: glPrimitiveRestartIndex
Next Topic: Usage of images in different .h and .cpp files
Goto Forum:
  


Current Time: Fri Mar 29 09:20:56 CET 2024

Total time taken to generate the page: 0.01191 seconds