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 » Main frame dlg: How to store last dimension and position?
Main frame dlg: How to store last dimension and position? [message #29679] Mon, 08 November 2010 10:21 Go to next message
JoseB is currently offline  JoseB
Messages: 37
Registered: March 2009
Member
Hi
I would like to store the dimension and position of the main frame dlg in order to open it in the same place with the same dimenson next time.
How to do this?
I know that i have to use files but i am having some dificulties looking for the methods that get windows dimension and position.
Any help would be very appreciated.

Thank you

JoseB
Re: Main frame dlg: How to store last dimension and position? [message #29680 is a reply to message #29679] Mon, 08 November 2010 11:28 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Hello JoseB

To store data between runs the best way is to use Serialize (binary files) or Xmlize (xml files).

Just try the examples, they are easy to use.

To get and set TopWindow position you can use GetRect() and SetRect(). For example, imagine a button that, when you push it, your window is moved 200 pixels. The function to do it could be:

void MyWindow::OnPush() {
	Rect r = GetRect();
	r.Offset(200, 0);
	SetRect(r);
}


Best regards
Iñaki
Re: Main frame dlg: How to store last dimension and position? [message #29684 is a reply to message #29680] Mon, 08 November 2010 12:23 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Or you can use SerializePlacement.

See e.g. here:

http://www.ultimatepp.org/examples$ImageView$en-us.html
Re: Main frame dlg: How to store last dimension and position? [message #29798 is a reply to message #29684] Thu, 18 November 2010 06:52 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

But How to restore maximize status?

SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: Main frame dlg: How to store last dimension and position? [message #29853 is a reply to message #29798] Mon, 22 November 2010 21:03 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

Under UBUNTU SerializePlacement does not restore maximize status.

SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: Main frame dlg: How to store last dimension and position? [message #29891 is a reply to message #29853] Sat, 27 November 2010 18:46 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
sergeynikitin wrote on Mon, 22 November 2010 15:03

Under UBUNTU SerializePlacement does not restore maximize status.


Unfortunately, it looks like "maximize" is not supported by X11 protocol as operation, or it was not at time we created SerializePlacement.

Somebody should look into it...

Mirek
Re: Main frame dlg: How to store last dimension and position? [message #30092 is a reply to message #29891] Wed, 08 December 2010 13:12 Go to previous messageGo to next message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

But Operation Maximize work fine in linux!
Maybe code of serializeplacement need some corrections?


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Re: Main frame dlg: How to store last dimension and position? [message #30096 is a reply to message #30092] Thu, 09 December 2010 06:48 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
sergeynikitin wrote on Wed, 08 December 2010 07:12

But Operation Maximize work fine in linux!
Maybe code of serializeplacement need some corrections?


How do you interpret the sentence: "Somebody should look into it..." ? Smile

The problem is that right now I am too busy to do that, plus right now X11 is not my primary platform.... So patch is welcome Smile

Mirek
Re: Main frame dlg: How to store last dimension and position? [message #30394 is a reply to message #29891] Mon, 27 December 2010 18:55 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
mirek wrote on Sat, 27 November 2010 12:46

sergeynikitin wrote on Mon, 22 November 2010 15:03

Under UBUNTU SerializePlacement does not restore maximize status.


Unfortunately, it looks like "maximize" is not supported by X11 protocol as operation, or it was not at time we created SerializePlacement.

Somebody should look into it...



I was wrong, all fixed, it now should behave as expected.

Mirek
Re: Main frame dlg: How to store last dimension and position? [message #30965 is a reply to message #30394] Sun, 30 January 2011 16:15 Go to previous message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

Thanks. Smile

SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
Previous Topic: How to convert utf-8 to (strcmp type)?
Next Topic: Menu problem on windows
Goto Forum:
  


Current Time: Thu Mar 28 19:59:06 CET 2024

Total time taken to generate the page: 0.00935 seconds