• Welcome to Powerbasic Museum 2020-B.
 

News:

Forum in repository mode. No new members allowed.

Main Menu

Simulated X window bar.

Started by Robert Sarrazin, August 29, 2011, 11:47:27 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Robert Sarrazin

Hi, I try to use a bitmap skin and I created ( X ) ???
a button call Xbutton to exit the program.

-----------------------
SUB FORM1_XBUTTON_Events( MyID&, CMsg&, CVal&, Cancel&)
     SELECT CASE CMsg&
          CASE %EZ_Click
                 (what is the best to exit  ::) )
          CASE ELSE
     END SELECT
END SUB
-----------------------
do I have to sent message terminate,
or exit,
or use %WM_CLOSE,0,0   EXIT FUNCTION
or use the END statement (NEW!)  Purpose
Terminate program immediately.
Syntax  END [nErrorLevel&]

I just try to find  the best way to exit :)

Christopher Boss

Robert,

Your code is EZGUI event code, not API code, so when using EZGUI you close a form like this:

EZ_UnloadForm "MyFormName"

EZGUI handles the rest. You can put such code in the %EZ_Click event for a button control if you like.


Christopher Boss

You can use something like this:


SUB FORM1_XBUTTON_Events( MyID&, CMsg&, CVal&, Cancel&)
     SELECT CASE CMsg&
          CASE %EZ_Click
               EZ_UnloadForm "{ME}"
          CASE ELSE
     END SELECT
END SUB


EZGUI 5.0 supports a new quick syntax, if the code will effect the same form as the event occurred for, which is "{ME}"

Assuming the button control is on the same form you want to close, then "{ME}" is fine.

As far as terminating the application, EZGUI automatically terminates the app when the last form is closed (or unloaded).