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 » U++ Library support » TopWindow&PopUp, TrayIcon » Toolbox inside a TopWindow
icon5.gif  Toolbox inside a TopWindow [message #13887] Thu, 31 January 2008 02:47 Go to next message
indiocolifa is currently offline  indiocolifa
Messages: 49
Registered: January 2008
Location: Argentina
Member
Hi, i'm getting my first U++ steps and it blows away another cumbersome frameworks! i don't understand why U++ isn't promoted much, it's better than other famous frameworks.

Well what i'm trying to do is to open a TopWindow but inside it I want a toolbox window (that is, this toolbox will be restricted into the top window frame).

This is what I've done (and of course does not work):

/* Main Window Header */
#include "Toolbox.h"
#include <CtrlLib/CtrlLib.h>

using namespace Upp;
//------------------ mainwindow.h -----------------------
class MainWindow : public TopWindow
{
	Toolbox	toolWnd;
		
	public:	
	MainWindow();
};

//------------------ mainwindow.cpp -----------------------
MainWindow::MainWindow()
{
	Sizeable();
	toolWnd.ToolWindow();
	toolWnd.SetRect(0,0,200,200);
	toolWnd.Open(this);
}

//--------------------------- toolbox.h-------------------
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
class Toolbox : public TopWindow
{
	
	public:
	
	Toolbox();	
};

// ------------------toolbox.cpp-------------------
#include "Toolbox.h"

Toolbox::Toolbox()
{
	Title("Toolbox");
	
}



Any help? thank you in advance, and keep up the good work !

[Updated on: Thu, 31 January 2008 02:48]

Report message to a moderator

Re: Toolbox inside a TopWindow [message #13889 is a reply to message #13887] Thu, 31 January 2008 11:25 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
The major problem with the code you posted is that you are trying to open the tool window in the constructor of the main window. This doesn't work because at that point the main window hasn't been opened yet.

A better solution is to add this function to the main window:
Quote:

virtual void State(int reason) {
if (reason == Ctrl::OPEN) {
toolWnd.SetRect(Rect(0, 0, 140, 200));
toolWnd.ToolWindow().Open(this);
toolWmd.CenterOwner();
}
}


However, if you want the window to be resticted to the borders of the main window it is a different problem, more like MDI. There is no intrinsic way of doing this in Upp, though you can imitate it using a normal ctrl with a 'fake' window frame.
Re: Toolbox inside a TopWindow [message #13897 is a reply to message #13887] Thu, 31 January 2008 20:04 Go to previous messageGo to next message
indiocolifa is currently offline  indiocolifa
Messages: 49
Registered: January 2008
Location: Argentina
Member
I'm interested in the "fake frame" approximation. Can you give me more details?
Re: Toolbox inside a TopWindow [message #13910 is a reply to message #13897] Fri, 01 February 2008 15:59 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
I've got something similar to what you need already written for something else. You are free to use it, though I offer no guarantee as to it's quality. See attached zip.

What you do is create a ctrl that is added to a window as normal, but pretends to be a Window by implementing dynamic sizing and trying to match the appearance of a native window. My version behaves correctly, though the appearance is not particularly good.
  • Attachment: MDITest.zip
    (Size: 13.72KB, Downloaded 410 times)
Re: Toolbox inside a TopWindow [message #13927 is a reply to message #13910] Fri, 01 February 2008 22:07 Go to previous message
indiocolifa is currently offline  indiocolifa
Messages: 49
Registered: January 2008
Location: Argentina
Member
Does not look bad!!!

Maybe in the future we need MDI in U++ (altough I don't know if it's easy to implement under X11).
Previous Topic: Problems with CursorImage/Popups/Frames on X11
Next Topic: Linux TrayIcon menu improvement
Goto Forum:
  


Current Time: Thu Mar 28 12:47:43 CET 2024

Total time taken to generate the page: 0.01869 seconds