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 » TopWindow&PopUp, TrayIcon » How to do something when window is shown
How to do something when window is shown [message #17077] Sun, 27 July 2008 23:38 Go to next message
cbpporter is currently offline  cbpporter
Messages: 1383
Registered: September 2007
Senior Contributor
Is there a way to handle the window show event (every time it is opened, but not when it is just activated)?

And what event sets of WhenAction for a TopWindow?
Re: How to do something when window is shown [message #17080 is a reply to message #17077] Mon, 28 July 2008 10:42 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
virtual void State(int reason)
{
  BaseClass::State(reason);
  if (reason == Ctrl::OPEN) {
    // Window opening
  }
}

There are other states also.

As far as I know, nothing triggers a TopWindow's WhenAction, and a quick source search fails to turn anything up.
Re: How to do something when window is shown [message #17085 is a reply to message #17080] Mon, 28 July 2008 13:26 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1383
Registered: September 2007
Senior Contributor
Thanks! Worked great.
Re: How to do something when window is shown [message #17163 is a reply to message #17085] Fri, 01 August 2008 08:55 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 11844
Registered: November 2005
Ultimate Member
Might I ask why you need this? It is in the "State" only because it is usually not needed... (E.g. the only use in the whole uppsrc is, AFAIK, in DHCtrl).

Mirek
Re: How to do something when window is shown [message #17174 is a reply to message #17163] Fri, 01 August 2008 10:49 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1383
Registered: September 2007
Senior Contributor
I need it because I have a dialog that need to update itself on a show operation from a cache. I could do something like first update, and then call Show, but since the dialog gets shown from a lot of different places and it's content is determined by the cash, I considered it would be better for the dialog to be the one who "owns" the method of updating. This way all the clients of the dialog don't have to care if it is updated or not, the just show it. It is a better design IMO.

Do you have a better solution for this? In my previous experience with GUI toolkits, OnShow and OnActivate were quite important and events. In U++, this is the first time I need an OnShow event.
Re: How to do something when window is shown [message #17224 is a reply to message #17174] Sun, 03 August 2008 14:09 Go to previous message
mirek is currently offline  mirek
Messages: 11844
Registered: November 2005
Ultimate Member
cbpporter wrote on Fri, 01 August 2008 04:49

I need it because I have a dialog that need to update itself on a show operation from a cache. I could do something like first update, and then call Show, but since the dialog gets shown from a lot of different places and it's content is determined by the cash, I considered it would be better for the dialog to be the one who "owns" the method of updating. This way all the clients of the dialog don't have to care if it is updated or not, the just show it. It is a better design IMO.

Do you have a better solution for this? In my previous experience with GUI toolkits, OnShow and OnActivate were quite important and events. In U++, this is the first time I need an OnShow event.


I would just add some sort of "ShowMe" method which updates from the cache. If you are afraid of calling "normal" Show accidentally, you can always make it private.

Mirek
Previous Topic: Wrong LeftUp Message send
Next Topic: Maximize Promblem with Ubuntu6.10 on amd64
Goto Forum:
  


Current Time: Thu Apr 25 12:06:29 CEST 2019

Total time taken to generate the page: 0.00698 seconds