Menu

#50 Control the use of X button of a window or a dialog

v1.0_(example)
open
nobody
1
2022-06-03
2022-05-15
No

I have tried fivelinux.

I haven't found the interest to move from hwgui to fivelinux, but I found a feature which is nice, and missing in hwgui.

The possibility to avoid to close window or dialog with the system button (X), or to control it with a Message (Yes-No)

Example :
ACTIVATE WINDOW oMainWindow VALID MsgYesNo( "Want to end ?" )

Thanks
A+

Discussion

  • Wilfried Brunken

    Hello Alain,
    very easy, use the ON EXIT option.

    Here the sample of my App "CLLOG":

     INIT WINDOW oWndMain ; 
       BACKCOLOR 0 ; && 0x3C3940 ;
       AT MainW_Xat, MainW_Yat  SIZE MainW_XSize,MainW_YSize + nNightOffset;
       STYLE WS_SYSMENU+WS_SIZEBOX+WS_VISIBLE ;
       ICON oIcon1 ;
       ON EXIT {|| LOGW_REQRT()  }
    

    ....
    ====================================
    FUNCTION LOGW_REQRT * Ask user for really quit. * (problem solved: unvisible title ) * Setting of * bforce_quit = .T. * supresses the quit dialog * and force the immediate * termination of the programm, * e.g. for maintenance like * deleting index, order data ... * ====================================
    LOCAL brt
    IF bforce_quit
    brt := .T.
    ELSE
    IF bLangEnglish
    brt := hwg_MsgYesNo("Really quit","Log")
    else
    brt := hwg_MsgYesNo("Wirklich beenden","Logbuch")
    endif
    ENDIF
    RETURN brt

    With regards,
    MNI TNX, 73 es 55 de
    DF7BE, Wilfried

     
  • Aupeix Alain

    Aupeix Alain - 2022-05-21

    Nice,

    I have first had a problem, because I called the same function with button, menu and X menu.
    The way was to call hwg_EndWindow() from the button and the menu, and my function with X menu.

    Thanks
    A+

     
  • Wilfried Brunken

    Hello Alain,
    I think, your problem is solved and this ticket can be closed.

    Hello Alexander, Hello Maurizio,
    please close this ticket.

    With regards
    MNI TNX , 73 es 55 de
    DF7BE, Wilfried

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.