iconize window

iconize window

Postby Detlef Hoefner » Thu Oct 18, 2007 1:58 pm

Hi all,

I want to activate a timer in the moment a window is iconized to the taskbar.
Since there is no ON ICONIZE clause, i don't know what event i can use.

Thanks for any hint,
Detlef
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Postby James Bott » Thu Oct 18, 2007 3:48 pm

Detlef,

You could use another timer to periodically check isIconic(), then start the timer you want when it is true.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Enrico Maria Giordano » Thu Oct 18, 2007 4:01 pm

Or use ON RESIZE.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8716
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby James Bott » Thu Oct 18, 2007 4:22 pm

>Or use ON RESIZE.

A good idea, but the timer would be triggered for any resize not just iconizeng.

Detlef, I do wonder what you are attempting to do? What if they don't iconize it but merely switch to another application? I rarely iconize an app, but just switch to another using the taskbar.

If you are trying to find out if the app is inactive, then I think you are going to have to monitor the event handler or something.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby nageswaragunupudi » Thu Oct 18, 2007 4:38 pm

I have this working code in my programs:

........ ON RESIZE WinResize(oWnd) .......

Code: Select all  Expand view  RUN
STATIC FUNCTION WinResize( oWnd )

  IF IsIconic( oWnd:nWnd )
         // my code what to do when first iconized
   ELSE
        // do what is needed here
   ENDIF

RETURN .T.

I use this not for starting timer but for other purposes. this works for starting a timer also
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby Detlef Hoefner » Thu Oct 18, 2007 4:40 pm

Enrico and James,

thank you for jumping in.

As James said, "on resize" would trigger the timer start every time a user resizes the window of my app.

The intention is the following:
In our company there are 5 workstations which create invoices.

If a new invoice has been created a popup window with a browse should open to show the most recent invoices which not yet have been printed.

My timer looks in 5 different dbf files for new invoices. If he found one i do deactivate the timer.
So the user can start all printing and optical storage routines.
When he is finished he will collapse the app window into the task bar.

For the moment i have a extra button to iconize.
But our users are usesd to click on the iconize symbol.

That's my problem.

Regards,
Detlef
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Postby James Bott » Thu Oct 18, 2007 4:48 pm

Detlef,

Perhaps what you want is to start the timer on bLostFocus and stop it on bGotFocus.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Detlef Hoefner » Thu Oct 18, 2007 4:55 pm

James,

this sounds like a good idea.
I'll try it.

Thanks, James
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Postby Enrico Maria Giordano » Thu Oct 18, 2007 5:11 pm

James Bott wrote:>Or use ON RESIZE.

A good idea, but the timer would be triggered for any resize not just iconizeng.


This is not true. ON RESIZE automatically provides nSizeType that can be any of the following values:

Code: Select all  Expand view  RUN
#define SIZE_RESTORED   0
#define SIZE_MINIMIZED  1
#define SIZE_MAXIMIZED  2
#define SIZE_MAXSHOW    3
#define SIZE_MAXHIDE    4


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8716
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby James Bott » Thu Oct 18, 2007 5:14 pm

Detlef,

>If a new invoice has been created a popup window with a browse should open to show the most recent invoices which not yet have been printed.

I assume you mean that the app is iconized (or better, not in focus) when this window pops up? Is this so they know there is a new invoice to handle? Wouldn't you really want a popup notice of a new invoice even if the app isn't iconized and they were working in it?

Is this happening on all 5 workstations? Are any one of the five people supposed to handle the new invoice? Can't the invoices just be printed automatically without user intervention?

>My timer looks in 5 different dbf files for new invoices.

Hmm. You have a different DBF for each workstation? Why? Can't you put them all in the same DBF?

>If he found one i do deactivate the timer. So the user can start all printing and optical storage routines. When he is finished he will collapse the app window into the task bar.

I don't see why you would need to deactivate the timer. After the timer routine finds a new invoice it pops up the window, then ignores that new invoice and starts looking for another. If the timer isn't checking too often (say once a minute), it isn't going to affect the performance of the program while the user is working. That way while they are working it would still notify them of a new invioce.

>For the moment i have a extra button to iconize.
>But our users are usesd to click on the iconize symbol.

As I mentioned in my previous message, lots of users are just going to click on another task on the taskbar or open another task on the menu--this is one less click than iconizing then clicking on another task. There is no need to iconize an app.

I think there are better ways to handle your problem.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby James Bott » Thu Oct 18, 2007 5:17 pm

Enrico,

>This is not true. ON RESIZE automatically provides nSizeType that can be any of the following values:

Ah, I didn't know that. But in his situation I think checking for iconized is not going to work. See my other message discussing his problem.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Enrico Maria Giordano » Thu Oct 18, 2007 5:54 pm

James Bott wrote:But in his situation I think checking for iconized is not going to work. See my other message discussing his problem.


I'm not sure to have understood the Detlef's problem but I tend to agree.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8716
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Detlef Hoefner » Thu Oct 18, 2007 7:56 pm

James,

thanks for your thorough thoughts about my problem.
I know that there are better ways to handle this task.

But this would end in a deep redesign of our invoicing system.
Unfortunatelly my boss would only accept such work if it would be done in a week :cry:

So i must must find a quick ( and dirty ) solution for my problem.

Enrico helped me with his information about nSizeType which i didn't know before.

Thanks Enrico and James,
Detlef
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Postby James Bott » Thu Oct 18, 2007 8:46 pm

Detlef,

>So i must must find a quick ( and dirty ) solution for my problem.

>Enrico helped me with his information about nSizeType which i didn't know before.

OK, I understand. However, checking for iconized is not going to tell you if they just switched to another app (without iconizing), so the bLostFocus/bGotFocus system would be a better solution and doesn't require any more work.

However, I still think you should just run the timer all the time. I don't see any problem with that. This should require even less work.

You should be able to do either one in an hour or less.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby StefanHaupt » Fri Oct 19, 2007 7:28 am

Detlef,

try the following

Code: Select all  Expand view  RUN
ACTIVATE WINDOW ::oWnd ;
             ;//ON INIT ;
             ON RESIZE If( nSizeType == SIZE_MINIMIZED, <StartTimer>, <EndTimer> ) ;
             VALID ::End()


It should work
kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 95 guests