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 » Top starting position of GUI changes.
Top starting position of GUI changes. [message #33125] Sat, 09 July 2011 02:06 Go to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
I have several U++ apps that a user can drag the GUI and the next time it is opened that is where it will be.

Works OK on WinXP and Ubuntu.

On Win Vista and W7 the top position creeps down.

Attached is a package that shows this behavior.

I put a break point at line 80 to see what is being saved.
Just opening the app and clicking File=>Save>exit it creeps down as it is displayed lower each time:
48
55
63
72
83
etc.

The left position seem OK it is just the top position that creeps down.
This is with U++ 3627 and earlier builds have the same problem.

I have tried this app (the .exe) on several different computers with Vista and W7 and all have shown this.

Even hard coding the top position the GUI is displayed lower than it should be.
Re: Top starting position of GUI changes. [message #33130 is a reply to message #33125] Sat, 09 July 2011 13:14 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Hi Neil!

The problem is that you use different coordinates when saving the positions then when setting it. GetRect() in you exit function returns absolute position in pixels, while TopPosZ() and LeftPosZ() work with "zoomed coordinates".

The solution you probably want is to use the "non-Z" functions:
LeftPos(leftP, 280).TopPos(topP, 135);


Best regards,
Honza

PS:
#include <windows.h>
#include <iostream>
#include <fstream>
#include <string>

#include <sstream>
#include <time.h>

#include <iostream>
#include <fstream>
using namespace std;

using namespace std;
These includes at the beginning of your files are useless, and especially the windows.h kind of scared me - it obviously fails to compile on non-windows sytems Wink
Re: Top starting position of GUI changes. [message #33145 is a reply to message #33130] Mon, 11 July 2011 07:01 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
Hi Honza

I just removed all the code from another app to show the problem, maybe the "#include <windows.h>" can be removed from all.

I didn't know there was a "non-Z" functions:

I changed the code from:
LeftPosZ(leftP, 248).TopPosZ(topP, 51);

to:
SetRect(leftP, topP, 248, 51);

I just have a Win XP with me, may be a few days til I get back and can check it on Vista and W7

I will try your "non-Z" also.

What advantage is there with "LeftPos(..." over "SetRect(..."?
Re: Top starting position of GUI changes. [message #33146 is a reply to message #33145] Mon, 11 July 2011 08:00 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

nlneilson wrote on Mon, 11 July 2011 07:01

What advantage is there with "LeftPos(..." over "SetRect(..."?

None Smile Actually, in this case I would use SetRect. The *Pos() functions are useful when you want some advanced positioning made easy, imagine that you want to put widget in the bottom, horizontally centered. That would require quite some arithmetic using SetRect, while HCenterPos(width).BotomPos() will calculate it for you. Also, when positioning Ctrls, these functions are usually a must, because they ensure proper behavior when the window is resized.

Honza
Re: Top starting position of GUI changes. [message #33212 is a reply to message #33146] Sat, 16 July 2011 12:28 Go to previous message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
Hi Honza

SetRect works OK with Win Vista and W7.

Thanks for the explanation of *Pos.

None of my GUI apps are re-sizable.

Neil
Previous Topic: Problem with GUI_APP_MAIN - example
Next Topic: umk is a virus! according to avira
Goto Forum:
  


Current Time: Sat Apr 27 21:21:24 CEST 2024

Total time taken to generate the page: 0.02783 seconds