Page 1 of 1

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

Posted: Tue Sep 22, 2015 6:40 am
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..

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

Posted: Wed Sep 23, 2015 8:26 am
by Antonio Linares
Please review FWH\samples\TestTray.prg