Sorry I posted to the Source code forum. about the DOEVENTS.
It doesnt do anything with a modal dialog.
I also apologize for not being more clear on my alternative.
The alternative was not really changing any color, and as a result the control kill and control add can be eliminated. Instead, substituting a sub that
adds lines (control kill/add line) to make the label appear indented or raised
depending on whather it has been 'pushed' or not. The 'lines' would be the 'shading' to the button area similar to what you would do in a ms-dos basic program after creating a box.
This is more like what I meant (adjusted for PBwin 8+ and below)
It doesnt do anything with a modal dialog.
I also apologize for not being more clear on my alternative.
The alternative was not really changing any color, and as a result the control kill and control add can be eliminated. Instead, substituting a sub that
adds lines (control kill/add line) to make the label appear indented or raised
depending on whather it has been 'pushed' or not. The 'lines' would be the 'shading' to the button area similar to what you would do in a ms-dos basic program after creating a box.
This is more like what I meant (adjusted for PBwin 8+ and below)
Code:
#COMPILE EXE #DIM ALL #INCLUDE "win32api.inc" %Test = 1001 GLOBAL Pushed% GLOBAL hDlg AS DWORD '****************************************************************************** ' ** Functions and Subs ** '****************************************************************************** DECLARE CALLBACK FUNCTION ShowDlgProc() DECLARE SUB pushreset '****************************************************************************** ' ** Program Entry Point ** '****************************************************************************** FUNCTION PBMAIN () AS LONG STATIC hParent AS DWORD 'STATIC hDlg AS DWORD STATIC ClientX AS DWORD STATIC ClientY AS DWORD STATIC DlgSizeX AS DWORD STATIC DlgSizeY AS DWORD STATIC CtrlX AS DWORD STATIC CtrlY AS DWORD LOCAL lRslt AS DWORD pushed%=0 DESKTOP GET CLIENT TO ClientX, ClientY DIALOG NEW PIXELS, hParent, "Animated Label", 0, 0, 800, 500, %WS_SYSMENU, TO hDlg DIALOG SET COLOR hDlg, -1, %CYAN DIALOG GET SIZE hDlg TO DlgSizeX, DlgSizeY DIALOG SET LOC hDlg, (ClientX - DlgSizeX) / 2, (ClientY - DlgSizeY) / 2 CONTROL ADD LABEL, hDlg, %Test, "Standby", 340, 200, 128, 128, %SS_CENTER OR %SS_CENTERIMAGE OR %SS_NOTIFY, , CONTROL SET COLOR hDlg, %Test, %BLUE, %YELLOW CONTROL GET SIZE hDlg, %Test TO CtrlX, CtrlY CONTROL SET LOC hdlg, %Test, (DlgSizeX - CtrlX) / 2, (DlgSizeY - CtrlY) / 2 DIALOG SHOW MODAL hDlg, CALL ShowDlgProc TO lRslt END FUNCTION '****************************************************************************** ' ** CallBacks ** '****************************************************************************** CALLBACK FUNCTION ShowDlgProc() SELECT CASE CBMSG CASE %WM_INITDIALOG pushed%=1 pushreset CASE %WM_COMMAND ' Process control notifications CONTROL SET FOCUS CBHNDL, CBCTL SELECT CASE AS LONG CBCTL CASE %Test pushReset ' CONTROL KILL CBHNDL, %Test ' CONTROL ADD LABEL, CBHNDL, %Test, "Working", 340, 200, 128, 128, %SS_CENTER OR %SS_CENTERIMAGE OR %SS_NOTIFY, %WS_EX_CLIENTEDGE, ' CONTROL SET COLOR CBHNDL, %Test, %BLUE, %GREEN ' CONTROL REDRAW CBHNDL, %Test ' 'DIALOG DOEVENTS 1 ' SLEEP 1000 ' CONTROL KILL CBHNDL, %Test ' CONTROL ADD LABEL, CBHNDL, %Test, "Standby", 340, 200, 128, 128, %SS_CENTER OR %SS_CENTERIMAGE OR %SS_NOTIFY, , ' CONTROL SET COLOR CBHNDL, %Test, %BLUE, %YELLOW ' CONTROL REDRAW CBHNDL, %Test END SELECT END SELECT END FUNCTION SUB pushreset IF pushed%=1 THEN CONTROL KILL hDlg,101 CONTROL KILL hDlg,102 CONTROL KILL hDlg,103 CONTROL KILL hDlg,104 CONTROL ADD LINE,hDlg, 101,"",339,199,130,2,%SS_BLACKFRAME CONTROL ADD LINE,hDlg, 102,"",339,199,2,129,%SS_BLACKFRAME CONTROL ADD LINE,hDlg, 103,"",339,326,129,2,%SS_WHITEFRAME CONTROL ADD LINE,hDlg, 104,"",468,199,2,130,%SS_WHITEFRAME pushed%=0 ELSE CONTROL KILL hDlg,101 CONTROL KILL hDlg,102 CONTROL KILL hDlg,103 CONTROL KILL hDlg,104 CONTROL ADD LINE,hDlg, 101,"",339,199,130,2,%SS_WHITEFRAME CONTROL ADD LINE,hDlg, 102,"",339,199,2,129,%SS_WHITEFRAME CONTROL ADD LINE,hDlg, 103,"",339,326,129,2,%SS_BLACKFRAME CONTROL ADD LINE,hDlg, 104,"",468,199,2,130,%SS_BLACKFRAME pushed%=1 END IF END SUB
Comment