How can I show original original window after Menutray.prg?

Post Reply
User avatar
kim yong woo
Posts: 55
Joined: Sun Apr 12, 2009 10:51 am
Location: Seoul, Korea
Contact:

How can I show original original window after Menutray.prg?

Post by kim yong woo »

Dear Sirs,

I have combined Menutray() and added oWnd:hide() on Window minimize button, as followings.
To add oWnd:hide() on minimize button, referred Mr. Enrico Maria Giordano's comments.

Code: Select all

Function Main()
   DEFINE Window oWnd  TITLE "Test Call"

   DEFINE BUTTON resource "EXIT" of oBar  Message "Exit"   Group  Action ( lExit:=.t., oWnd:end() )


    ACTIVATE WINDOW oWnd Maximized ;
     ON INIT (oTray := TTrayIcon():New( oWnd, oIcon, "Testing tray ...",;
             { || MsgInfo( "Left CLick" ) },;
             { | nRow, nCol | MenuTray( nRow, nCol, oTray ) } ),oWnd:Show()) ;
     ON RESIZE SHOWRESIZETYPE( nSizeType ) ;
     VALID ( oWnd:hide(), lExit )

Return nil


#define SIZE_INIT      NIL
#define SIZE_RESTORED  0
#define SIZE_MINIMIZED 1
#define SIZE_MAXIMIZED 2

STATIC FUNCTION SHOWRESIZETYPE( nSizeType )
  STATIC lInit := .T.

    DO CASE
        CASE nSizeType = SIZE_INIT
            lInit = .F.
        CASE nSizeType = SIZE_RESTORED .AND. !lInit
        CASE nSizeType = SIZE_MINIMIZED
           oWnd:hide()
        CASE nSizeType = SIZE_MAXIMIZED
    ENDCASE

RETURN NIL

Function MenuTray( nRow, nCol, oTray )

   local oMenu

   MENU oMenu POPUP
      MENUITEM "Show" ACTION oWnd:Show(), oWnd:SetFocus()
      MENUITEM "Hide" ACTION oWnd:Hide()
      SEPARATOR
      MENUITEM "Close Application" ACTION ( lExit:=.t., oWnd:end() )
   ENDMENU

   ACTIVATE POPUP oMenu AT nRow, nCol OF oTray:oWnd

return NIL
 
But, When I clicked oWnd:Show() in Tray, It doesn't roll back to original windows, at one time..

1. It showed..
http://pharmalink.kr/images/Tray01.jpg

2.Click Tray "Show""
http://pharmalink.kr/images/Tray02.jpg

3.Click Bottom icon, again..
http://pharmalink.kr/images/Tray03.jpg

4.Then, It was possible to see Original window..
http://pharmalink.kr/images/Tray04.jpg

How Can I modify my codes?

Thanks in advance..
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: How can I show original original window after Menutray.prg?

Post by Antonio Linares »

Please review FWH\samples\TestTray.prg
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply