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 » Upp GUI size in Win and Ubuntu
Upp GUI size in Win and Ubuntu [message #39866] Wed, 08 May 2013 01:18 Go to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
I was not sure what topic to post this in.

To build/compile a GUI in Win and run in Ubuntu with wine it is much smaller than if it is built with GCC in Ubuntu.

It is the same code for the GUI and the dlg.lay size is (260,83) in both. The lower Upp GUI is from Win.

index.php?t=getfile&id=4178&private=0

[Updated on: Wed, 08 May 2013 01:50]

Report message to a moderator

Re: Upp GUI size in Win and Ubuntu [message #39869 is a reply to message #39866] Wed, 08 May 2013 17:28 Go to previous messageGo to next message
BioBytes is currently offline  BioBytes
Messages: 285
Registered: October 2008
Location: France
Experienced Member
Hello Neil,

Even the fonts seem different.

Biobytes
Re: Upp GUI size in Win and Ubuntu [message #39873 is a reply to message #39869] Wed, 08 May 2013 19:51 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
Hi Biobytes

Yes everything seems to be proportionally bigger.

The Upp GUI in Ubuntu is way too big.

With the dlg.lay size of (260,83) it should be no bigger than that whether on Win or some Linux distro, I only have Ubuntu to try it on.

Here is the dlg.lay
LAYOUT(DlgLayout, 260, 83)
	ITEM(EditField, Point1, SetFont(StdFontZ(12).Bold()).WantFocus(false).LeftPosZ(44, 200).TopPosZ(0, 16))
	ITEM(EditField, Point2, SetFont(StdFontZ(12).Bold()).WantFocus(false).LeftPosZ(44, 200).TopPosZ(16, 16))
	ITEM(EditField, Angle1, SetFont(StdFontZ(12).Bold()).WantFocus(false).LeftPosZ(44, 96).TopPosZ(32, 16))
	ITEM(EditField, Angle2, SetFont(StdFontZ(12).Bold()).WantFocus(false).LeftPosZ(149, 96).TopPosZ(32, 16))
	ITEM(EditField, Distance, SetFont(StdFontZ(12).Bold()).WantFocus(false).LeftPosZ(44, 96).TopPosZ(48, 16))
	ITEM(Label, units, SetFont(StdFontZ(12).Bold()).LeftPosZ(138, 30).TopPosZ(48, 16))
	ITEM(Label, dv___6, SetLabel(t_(" Point 1")).SetFont(StdFontZ(11)).LeftPosZ(0, 44).VSizePosZ(0, 67))
	ITEM(Label, dv___7, SetLabel(t_(" Point 2")).SetFont(StdFontZ(11)).LeftPosZ(0, 44).TopPosZ(16, 16))
	ITEM(Label, dv___8, SetLabel(t_(" Angle 1")).SetFont(StdFontZ(11)).LeftPosZ(0, 44).TopPosZ(32, 16))
	ITEM(Label, dv___9, SetLabel(t_("2")).LeftPosZ(142, 8).TopPosZ(32, 16))
	ITEM(Label, dv___10, SetLabel(t_(" Distance")).SetFont(StdFontZ(11)).LeftPosZ(0, 44).TopPosZ(48, 16))
	ITEM(EditField, Data1, WantFocus(false).LeftPosZ(1, 255).TopPosZ(64, 16))
	ITEM(Button, P1, SetLabel(t_("<")).SetFont(StdFont().Bold()).LeftPosZ(244, 16).TopPosZ(0, 16))
	ITEM(Button, P2, SetLabel(t_("<")).SetFont(StdFont().Bold()).LeftPosZ(244, 16).TopPosZ(16, 16))
	ITEM(EditField, count, AlignRight(true).SetFont(StdFont().Bold()).WantFocus(false).LeftPosZ(208, 52).TopPosZ(48, 16))
	ITEM(EditField, timezone, AlignRight(true).SetFont(StdFont().Bold()).WantFocus(false).LeftPosZ(184, 24).TopPosZ(48, 16))
END_LAYOUT


Re: Upp GUI size in Win and Ubuntu [message #39874 is a reply to message #39873] Wed, 08 May 2013 20:55 Go to previous messageGo to next message
BioBytes is currently offline  BioBytes
Messages: 285
Registered: October 2008
Location: France
Experienced Member
Hi,

Did you check this topic ?

http://www.ultimatepp.org/forum/index.php?t=msg&th=7576& amp;start=0&

Regards
Biobytes

[Updated on: Wed, 08 May 2013 20:55]

Report message to a moderator

Re: Upp GUI size in Win and Ubuntu [message #39875 is a reply to message #39874] Wed, 08 May 2013 23:06 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
Thanks for the link.

This is my sentiment as stated in previous post:
Didier wrote on Mon, 22 April 2013 11:17

I expect the dialog to STAY 320*240


Maybe it is a POSIX issue beyond the control of Upp.
Re: Upp GUI size in Win and Ubuntu [message #39879 is a reply to message #39875] Thu, 09 May 2013 07:32 Go to previous messageGo to next message
Sender Ghost is currently offline  Sender Ghost
Messages: 301
Registered: November 2008
Senior Member
Hello.
Didier wrote on Mon, 22 April 2013 11:17

I expect the dialog to STAY 320*240

He can't expect this for different user settings, than default (on the same operating system, window manager, etc.), at least for screen shot images. For example, if you change the DPI settings for your screen on Windows XP to some value, bigger than 100% (usually, 96), then you will have proportionally larger window size for GUI applications. Therefore, they might look different to the user with different settings (and to you, if (s)he sent screen shots of the GUI). But internally, the application will behave like it have the same size (320x240, in this case). In conclusion, this is what he could expect: the same (internal to application) window size, which might look proportionally smaller/bigger by user settings.

In case of Neil's screen shot, we have different fonts (The Wine is Tahoma; the Gnome is Liberation Sans) and their heights, but GUI is proportional, which is default behaviour of current U++ GUI applications.

To explicitly change the default font for the GUI, you have SetStdFont(Font font) function:
#include <CtrlLib/CtrlLib.h>

using namespace Upp;

GUI_APP_MAIN
{
	RDUMP(GetStdFont());

	Font fnt;
	fnt.FaceName("Tahoma").Height(15);
	SetStdFont(fnt);

	PromptOK("Hello World!");
}


To disable layout scaling by font size, you have Ctrl::NoLayoutZoom() static method:
#include <CtrlLib/CtrlLib.h>

using namespace Upp;

GUI_APP_MAIN
{
	PromptOK("With layout zoom");
	Ctrl::NoLayoutZoom();
	PromptOK("No layout zoom");
}


There are other static methods of Ctrl, which you might find interesting.

Edit: Changed Draw::SetStdFont(Font font) to SetStdFont(Font font) function.

[Updated on: Sat, 11 May 2013 10:26]

Report message to a moderator

Re: Upp GUI size in Win and Ubuntu [message #39884 is a reply to message #39879] Thu, 09 May 2013 10:16 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
Thanks Sender Ghost for the information.

edit: At first it seemed too easy but I was still on Win.
I tried the Ctrl::NoLayoutZoom(); and the size is still different.

I understand the user setting of DPI can make a difference but the above image is one screen shot in Ubuntu with the app running from TheIde and the app from Win running under wine at the same time, one is just moved below the other.

I think when installing or maybe later all the M$ fonts are installed in Ubuntu. They sure look the same except the size but the dot above the i is higher. I didn't try the Draw::SetStdFont(fnt); but maybe that will be necessary.


[Updated on: Thu, 09 May 2013 10:38]

Report message to a moderator

Re: Upp GUI size in Win and Ubuntu [message #39886 is a reply to message #39884] Thu, 09 May 2013 11:33 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
It depends on where that is placed in the code.
/home/neil/MyApps/NefbG2/NefbG2.cpp:26:21: error: ISO C++ forbids declaration of ‘NoLayoutZoom’ with no type [-
	fpermissive]
/home/neil/MyApps/NefbG2/NefbG2.cpp:26:21: error: cannot declare member function ‘Upp::Ctrl::NoLayoutZoom’ with
	in ‘NefbG2’


But here the app runs:
GUI_APP_MAIN{
 	Ctrl::NoLayoutZoom();
	NefbG2().Run();
	endX();
}


This makes the GUI smaller but it is only the top left of the original GUI that is left.
Re: Upp GUI size in Win and Ubuntu [message #39887 is a reply to message #39866] Thu, 09 May 2013 11:34 Go to previous messageGo to next message
piotr5 is currently offline  piotr5
Messages: 103
Registered: November 2005
Experienced Member
just because they are on the same os doesn't mean it's the same dpi-setting. in winecfg you can set up the dpi windows-programs will use, in linux you need to edit the configuration files for X and there set some dpi. wine does not automatically copy the system-wide settings, as far as I know in wine 96 is the default dpi no matter where...

and remember, in gui (especially in fonts) usually not the actual pixels are counted, instead it's the actual dpi-setting associated with those graphical elements. i.e. fixed-size fonts have the dpi-setting hardwired, gui-applications and TTF take the system-wide dpi settings...
Re: Upp GUI size in Win and Ubuntu [message #39892 is a reply to message #39887] Thu, 09 May 2013 14:50 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 541
Registered: November 2008
Location: France
Contributor
Hi all,

Ctrl::NoLayoutZoom(); did the trick for me, the background image now displays correctly (I didn't want to stretch it since it indicated me if the dialog displayed correctly or not) AND the application displays correctly on the 320*240 screen ( which size is of coarse fixed Wink )

Thank-you Sender-Ghost

[Updated on: Thu, 09 May 2013 15:01]

Report message to a moderator

Re: Upp GUI size in Win and Ubuntu [message #39901 is a reply to message #39892] Fri, 10 May 2013 04:48 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
I started tinkering with fonts but decided not to go that route.

piotr5 wrote on Thu, 09 May 2013 02:34

as far as I know in wine 96 is the default dpi no matter where...


I have 5 computers near or on a desk. Each has a Win and Ubuntu OS. When the Upp app is run with wine the size is OK. For a user or even myself to change the font for each where necessary is not a viable option. Letting them know Wine needs to be installed is a better option.

Ctrl::NoLayoutZoom(); works good for the GUI size. BUT: Even though each field in the dlg.lay is specified for location and size in pixels that is ignored or over ridden by the font size or whatever.

Is there a way to lock in all the dlg.lay dimensions?

edit: Apparently in Win OS the dimensions are locked in and independent of the font size. I changed one of the EditField size from 12 to SetFont(StdFontZ(60). It still displays the characters as size 12.

I am not that familiar with the Upp GUI code so I may be wrong.

[Updated on: Fri, 10 May 2013 05:32]

Report message to a moderator

Re: Upp GUI size in Win and Ubuntu [message #39905 is a reply to message #39901] Fri, 10 May 2013 10:38 Go to previous messageGo to next message
Sender Ghost is currently offline  Sender Ghost
Messages: 301
Registered: November 2008
Senior Member
nlneilson wrote on Fri, 10 May 2013 04:48

Is there a way to lock in all the dlg.lay dimensions?

I didn't find this function for layouts (and there is no such option for Layout Designer), except static Ctrl::NoLayoutZoom(). But possible to use not zoomed version of placement manually, e.g.:
#include <CtrlLib/CtrlLib.h>

using namespace Upp;

GUI_APP_MAIN
{
	EditString text, zoomedText;
	text.NullText("Normal"); zoomedText.NullText("Zoomed");
	TopWindow window;
	window.SetRect(Size(320, 240));

	window.Add(text.LeftPos(4, 100).TopPos(4, 20)); // Without Z suffix
	window.Add(zoomedText.LeftPosZ(4, 100).TopPosZ(28, 20));

	window.Run();
}

[Updated on: Fri, 10 May 2013 11:31]

Report message to a moderator

Re: Upp GUI size in Win and Ubuntu [message #39906 is a reply to message #39905] Fri, 10 May 2013 13:26 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
Now that is something that makes more sense to me.
I had no idea what the Z in LeftPosZ was for.

All my apps so far have not been re size-able.

That should be something I can work with.
Re: Upp GUI size in Win and Ubuntu [message #39907 is a reply to message #39906] Fri, 10 May 2013 16:46 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 657
Registered: September 2012
Location: Poland, Kraków
Contributor
Hello nlneilson,

Did you try to activate NOGTK compilation flag? This flag should solve all your graphics issues on Ubuntu.

Sincerely,
Klugier


Ultimate++ - one framework to rule them all.
Re: Upp GUI size in Win and Ubuntu [message #39912 is a reply to message #39907] Fri, 10 May 2013 23:26 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
Hi Klugier

How do you activate NOGTK compilation flag in Upp?

Can that be set in Build methods - Release fixed flags
Re: Upp GUI size in Win and Ubuntu [message #39913 is a reply to message #39912] Sat, 11 May 2013 00:10 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 657
Registered: September 2012
Location: Poland, Kraków
Contributor
Hello nlneilson,

This is the easiest way to change this flag:

1. Move mouse cursor to packeg list.
2. Press right button on it.
C. Alternatively: MenuBar > Project

3. Find "Main package configuration..." and select it.
C. We open configuration window.

4. Press left button on ArrayCtrl. (first row, "Flags" column)
C. We should see characteristic button with arrow.

5. Click button with arrow.
C. We open next configuration window.

6. Check NOGTK flag.
7. Press "OK" button.

If my tutorial proved to be not understandable, I have enclosed demonstrative image.

P.S.
"C." means comment.

Sincerely,
Klugier
  • Attachment: NOGTK.png
    (Size: 132.37KB, Downloaded 141 times)


Ultimate++ - one framework to rule them all.
Re: Upp GUI size in Win and Ubuntu [message #39916 is a reply to message #39913] Sat, 11 May 2013 04:41 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
Thanks Klugier

NOGTK works to keep the GUI the same size.

The instructions were very good but showing the pull-down where NOGTK is actually picked may help.

index.php?t=getfile&id=4188&private=0

I will still tinker with SetStdFont(Font font) as Sender Ghost mentioned and the Z zoom.
The horizontal lines between the EditFields I can tinker with.
Re: Upp GUI size in Win and Ubuntu [message #39966 is a reply to message #39916] Sun, 19 May 2013 01:53 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 657
Registered: September 2012
Location: Poland, Kraków
Contributor
Hello nlneilson,

Did you solve the problem?

In meanwhile, I have thought how we can fix this issue. The first alternative is to make conditional layout and make perfect layout on your target os. And don't forget about NOGTK flag. X11 mode is more stable than GTK backend. On the other hand this solution is not efficient, because you need to develop all your layouts together.

I have enclosed sample code:
#ifdef PLATFORM_X11
class MainWindow : public WithMainWindowLayoutX11 {
#else
class MainWindow : public WithMainWindowLayout {
#endif


You can alsow use following function:
ChClassicSkin ();

This function will transform your current colors and widgets to more similar to that used in "wine".

Sincerely,
Klugier


Ultimate++ - one framework to rule them all.

[Updated on: Sun, 19 May 2013 02:54]

Report message to a moderator

Re: Upp GUI size in Win and Ubuntu [message #39967 is a reply to message #39966] Sun, 19 May 2013 03:08 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
Hi Klugier

The NOGTK flag worked fairly well. If it is not as efficient the option for a better way would be good.

I have not tried Sender Ghost's manual suggestion but will.
	window.Add(text.LeftPos(4, 100).TopPos(4, 20)); // Without Z suffix


"X11 mode is more stable than GTK backend."
I don't understand this. If it takes longer to write the code isn't a problem but if effects it's running then it is a problem.
I am using MSC 12 for the updated C++ if that concerns the X11.

I will try ChClassicSkin ();
Re: Upp GUI size in Win and Ubuntu [message #39998 is a reply to message #39967] Fri, 24 May 2013 02:38 Go to previous messageGo to previous message
Klugier is currently offline  Klugier
Messages: 657
Registered: September 2012
Location: Poland, Kraków
Contributor
Hello,

What is X11? According to the wikipedia: "X11 is a computer software system and network protocol that provides a basis for graphical user interfaces (GUIs) and rich input device capability for networked computers.". More information you can find here: http://en.wikipedia.org/wiki/X11.

Now, Ultimate++ on unix like operating systems use two different redner method. The first is GTK Backend (Default). The second is X11. What is the difference between these two methods? Let's look at the following diagram:

Ultimate++ -> GTK+ -> X11 (GTK backend)
Ultimate++ -> X11 (NOGTK)

-> - means invoking

X11 mode is more stable, because the way to X server is shorter. Moreover, X11 mode on all posix systems looks exactly the same. It dosen't metter whether you are using GNOME or KDE.

-----------------------------------

GTK backend and X11 don't depend on Windows, so it doesn't matter which of these modes is turned on.

-----------------------------------

When I was writing about the efficiently I thought that you need to use conditional compilation to achieve better multiplatform code.

Sincerely,
Klugier


Ultimate++ - one framework to rule them all.

[Updated on: Sat, 25 May 2013 13:38]

Report message to a moderator

Previous Topic: Pick Semantics: Passing a Vector to a method
Next Topic: [Solved] SysInfo_Demo_Gui is where to find?
Goto Forum:
  


Current Time: Thu Jun 04 06:40:15 CEST 2020

Total time taken to generate the page: 0.01760 seconds