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 » U++ Widgets - General questions or Mixed problems » Understanding Frames
Re: Understanding Frames [message #3856 is a reply to message #3851] Sat, 01 July 2006 22:34 Go to previous messageGo to previous message
Werner is currently offline  Werner
Messages: 234
Registered: May 2006
Location: Cologne / Germany
Experienced Member
brianE wrote on Sat, 01 July 2006 00:09

Oh dear, I hope you don't mind my questions. Each time someone explains something I do some experiments and find new things to ask about!

I have read the 'About Frames' article. I see the Cyan portion as the 'body' of the window and is called frame0. Then you 'insert' a frame (in Green) on the left which squashes frame0. So, what can I do with this green space? is it dead? can I add Ctrls to it? Can I do a BlackFrame or ButtonFrame to it? Do I refer to it as frame number 1?

Now we do different clever things with another frame. This time we 'add' so that it goes inside the 'body'. Is it, too, dead or can I play with it? Is it frame number 2?

What I want to do is split a window into this:
   +--------------+
   |              |
   +---+----------+
   |   |          |
   |   |          |
   |   |          |
   +---+----------+
The top portion always stays the same height, the left portion always stays the same width. And I will want to put things inside them. Do I use FrameTop and FrameLeft? If so how? Or is it LayoutFrameTop etc? I know that I don't want a splitter because that's moveable and I've learnt how to use that! Anyway, I'm sorry, but I am confused about Frames.

<off topic> I read in one of the posts about people coming to Upp and perhaps not staying or maybe they just didn't like to post. Maybe because I am new but I see that lots of people have looked at the topics I have started - and no, it wasn't me! Anyway, I think one needs patience and perseverance and one will overcome all the starting difficulties and reap the rewards.</off topic>

Once I have mastered these pesky frames I will want to talk about DragAndDrop! Are you ready? Wink

brianE



I hope this helps:

#include <CtrlLib/CtrlLib.h>

// Refer to "Browse topics - src - CtrlCore - Ctrl" to see how positioning works

// initial window width
const int window_width = 600;
// initial window heighth
const int window_height = 400;

// fixed height of top rectangle
const int fixed_top = 100;
// fixed width of left rectangle
const int fixed_left = 50;

class App : public TopWindow
{
private:
	StaticRect top_left_to_right;
	StaticRect bottom_left;
	StaticRect bottom_right;
	
public:
	App()
	{
		// create StaticRect "top_left_to_right" with variable width and fixed height
		// set up variable width from left to right edge of window
		top_left_to_right.HSizePos(); // same as HSizePos(0, 0)
		// set up fixed height from top edge of window
		top_left_to_right.TopPos(0, fixed_top);
		// add color to make rectangle distinguishable
		top_left_to_right.Color(Red);
		// add rectangle to window
		Add(top_left_to_right);
		
		// create StaticRect "bottom_left" with fixed width and variable height
		// set up fixed width from left edge of window with fixed size
		bottom_left.HSizePos(0, fixed_left);
		// set up variable height from bottom edge of top_left_to_right to bottom edge of window
		bottom_left.VSizePos(fixed_top); // same as VSizePos(fixed_top, 0)
		// add color to make rectangle distinguishable
		bottom_left.Color(Green);
		// add rectangle to window
		Add(bottom_left);

		// create StaticRect "bottom_right" with variable width and variable height
		// set up variable width from left edge of bottom_left to right edge of window
		bottom_right.HSizePos(fixed_left); // same as HSizePos(fixed_left, 0)
		// set up fixed height from bottom edge of top_left_to_right to bottom edge of window
		bottom_right.VSizePos(fixed_top); // same as VSizePos(fixed_top, 0)
		// add color to make rectangle distinguishable
		bottom_right.Color(Blue);
		// add rectangle to window
		Add(bottom_right);
	}
};

GUI_APP_MAIN
{
    // window smaller than the fixed sizes seems not reasonable
    Size min_size;
    // double minimal width - otherwise resizing conflicts with fixed width (try out!)
    min_size.cx = fixed_left * 2;
    // minimal height
    min_size.cy = fixed_top;
    
    App app;
    app.Title("Resize window to see what happens");

    // window size: left edge, top edge, width, height - 0, 0, ..., ... means "center window"
    app.SetRect(0, 0, window_width, window_height);
    app.SetMinSize(min_size);
    app.Sizeable();
    app.Run();
}


... and don't look for frames - you won't find any Razz !

Werner
 
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: Mapping button to CALLBACK
Next Topic: scrolling without Frame and wrapping Ctrl?
Goto Forum:
  


Current Time: Sat Sep 06 22:15:53 CEST 2025

Total time taken to generate the page: 0.06999 seconds