HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: [Resolved] Example on how to store GUI position  (Read 2519 times)

MalikGray

  • General Accounts
  • *
  • Posts: 2
    • View Profile
[Resolved] Example on how to store GUI position
« on: Jun 22, 12, 02:48:33 PM »

I want to be able to open and close a GUI Window and still have it "remember" the position it was in before. So say for example it starts off in the center but then you drag it to the upper left hand corner. When you close it and reopen it, it should still be in the upper left hand corner. Also, the GUI position should be saved on a per player basis. I'm thinking I should be GLOMMING my GUI class onto the playeraccount. But, I'm not sure. Any help would be much appreciated. If possible please provide a code example. Its easier for me to learn from code. ^_^
« Last Edit: Nov 01, 12, 11:58:45 AM by HE-Cooper »
Logged

McMagic

  • General Accounts
  • *
  • Posts: 128
    • View Profile
    • Novus Inceptio
Re: Example on how to store GUI position
« Reply #1 on: Jun 22, 12, 04:12:26 PM »

...
« Last Edit: Mar 07, 14, 03:52:58 PM by McMagic »
Logged

JoshHalls

  • Founding Professional
  • *****
  • Posts: 335
    • View Profile
    • The Repopulation
Re: Example on how to store GUI position
« Reply #2 on: Jun 22, 12, 04:46:24 PM »

We save it to the local repository (not stored on the server of course).  All of our windows share the same core window element and we just take care of the updates via the primary method for the windows so it can save position and size.
Logged
Co-Owner/Programmer - The Repopulation

McMagic

  • General Accounts
  • *
  • Posts: 128
    • View Profile
    • Novus Inceptio
Re: Example on how to store GUI position
« Reply #3 on: Jun 22, 12, 04:53:28 PM »

...
« Last Edit: Mar 07, 14, 03:52:50 PM by McMagic »
Logged

MalikGray

  • General Accounts
  • *
  • Posts: 2
    • View Profile
Re: Example on how to store GUI position
« Reply #4 on: Jun 23, 12, 01:18:58 AM »

Josh, can you give me a code example of how I would go about doing that? Thanks for your help McMagic, its kinda hard to understand what's going on in your code because there's so much. Sorry >_<
Logged

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: Example on how to store GUI position
« Reply #5 on: Jun 23, 12, 09:15:57 AM »

I believe what McMagic was suggesting was that you use a persistent node to store the data, which would cause the data to be stored in the Hero databases behind the scenes.  One possibility for that, as he suggested, is to use the player account node (adding field(s) to it to store the data).

Any way you store it, the tougher part is the actual getting data from gui's to save and then restoring the gui's from the data later.
« Last Edit: Jun 23, 12, 09:17:33 AM by ScottZarnke »
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.