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 » Removing .lay dependancy from a GUI app
Removing .lay dependancy from a GUI app [message #27852] Fri, 06 August 2010 19:50 Go to next message
cullam is currently offline  cullam
Messages: 8
Registered: July 2010
Location: St. John's Canada
Promising Member
Hi Guys.

I've been working on a small set of graphical apps. When I started building them, I used information from one of tutorials, and a template to get started. Basically, the class that contains most of my important functionality is declared like this:

"class VectorsGUI : public UUVBase, public WithVectorsGUILayout<TopWindow>"

I've been doing alot of my own work here, and I'm not using any of UPP's built in graphical widgits. I've started separating my VectorsGUI class into two classes: one that does the basic stuff that I intend to extend on in other applications, and one that does the specific stuff that I want for this application. But to do this, my life would be made a lot easier if I no longer relied on "public WithVectorsGUILayout<TopWindow>", since the class that will want to control the window (I think) will have a different name, and I'd rather not have to use elements that work entirely "under the hood". Aside from that, I'm not actually using the layout file for anything, other than my window size, which I'm going to be reading in from a .conf file in future anyway.

So, in theory, there should be little to this. My main looks like:

#include "VectorsGUI.h"

#define VERSION "2010070801"
#define FILE_BASE "SQX-Drive"
#define FILE_TITLE String( FILE_BASE )


GUI_APP_MAIN
{
VectorsGUI(FILE_TITLE, FILE_BASE, VERSION ).Run();
}


Is there a simple way to have my code just use TopWindow directly, without the auto-generated constructor? And is there something additional I have to do to still be able to use Paint() and GetX()/GetY()?

I'm sure this is fairly easy, but I just don't know enough about how this constructor works. Thanks!
-cullam
Re: Removing .lay dependancy from a GUI app [message #27880 is a reply to message #27852] Mon, 09 August 2010 09:55 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
Eh, just inherit directly from TopWindow instead of using the WithXXXXLayout<> template. All lay related studd (includes, CtrlLayout etc) can then be removed.

I don't what you mean by GetX/Y, these function don't exist.

The code you'll want to use for setting window size will be something like:
wnd.SetRect(GetSizeFromConf())
wnd.CenterScreen();
Re: Removing .lay dependancy from a GUI app [message #27894 is a reply to message #27880] Mon, 09 August 2010 15:39 Go to previous messageGo to next message
cullam is currently offline  cullam
Messages: 8
Registered: July 2010
Location: St. John's Canada
Promising Member
Maybe I'm missing something here, but I've got the impression that the TopWindow class uses .lay files for it's initialization. When I've changed a class to inherit from TopWindow, I've got this error:

C:\upp2094\uppsrc\CtrlCore/TopWindow.h(239) : error C2665: 'InitLayout' : none of the 11 overloads could convert all the argument types
C:\upp2094\uppsrc\CtrlLib/Ctrl.lay(1): could be 'void Upp::InitLayout<T,T>(Upp::Ctrl &,L &,D &,Upp::EditStringLayout__layid &)'
with
[
T=GUIClass,
L=GUIClass,
D=GUIClass
]

Looking through it, it would seem that TopWindow is extended from Ctrl, which is looking for a layout file. So I've clearly missed something fundamental. I'm browsing around now, trying to squash it, but I might be going about that all wrong.

Sorry these questions are so basic, working with what I'm assuming is really simple, low level stuff for anyone with experience with this system. I guess I might just be better off to start a new project, not using the template, as that might have background effects that I'm not aware of.
-cullam
Re: Removing .lay dependancy from a GUI app [message #27895 is a reply to message #27894] Mon, 09 August 2010 15:41 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1401
Registered: September 2007
Ultimate Contributor
Try removing the CtrlLayout or similar call from you constructor? Or post a simple test case.
Re: Removing .lay dependancy from a GUI app [message #27896 is a reply to message #27895] Mon, 09 August 2010 16:16 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
Yeah, it's the CtrlLayout call. The implementation for that function is in the Layout template, so when you remove the template and leave the call you get errors. TopWindow has nothing to do with layout files by itself.
Re: Removing .lay dependancy from a GUI app [message #27897 is a reply to message #27896] Mon, 09 August 2010 17:39 Go to previous message
cullam is currently offline  cullam
Messages: 8
Registered: July 2010
Location: St. John's Canada
Promising Member
Yeah, that seems to have done it. Thanks guys. Hopefully now, I can get this all refactored and working.
Previous Topic: [solved]how to use upp without the ide (what is the gcc command line?)
Next Topic: Debugger’s Explorer tab & display of arrays/vectors
Goto Forum:
  


Current Time: Thu Mar 28 13:55:02 CET 2024

Total time taken to generate the page: 0.00994 seconds