I have recently discovered that a label with the %SS_SIMPLE style does not clear when a CONTROL SET TEXT is sent with "" as the string parameter whereas a label without that style does. A string of spaces will do the job, but it seems inconsistent to me.
Before I send anything to PB, I thought I would post some code to display the 'issue' and see if others thought it ..uh.. unusual?
Before I send anything to PB, I thought I would post some code to display the 'issue' and see if others thought it ..uh.. unusual?
Code:
#PBFORMS CREATED V1.51 '-------------------------------------------------------------------------------------------------- ' The first line in this file is a PB/Forms metastatement. ' It should ALWAYS be the first line of the file. Other ' PB/Forms metastatements are placed at the beginning and ' end of "Named Blocks" of code that should be edited ' with PBForms only. Do not manually edit or delete these ' metastatements or PB/Forms will not be able to reread ' the file correctly. See the PB/Forms documentation for ' more information. ' Named blocks begin like this: #PBFORMS BEGIN ... ' Named blocks end like this: #PBFORMS END ... ' Other PB/Forms metastatements such as: ' #PBFORMS DECLARATIONS ' are used by PB/Forms to insert additional code. ' Feel free to make changes anywhere else in the file. '-------------------------------------------------------------------------------------------------- #COMPILE EXE #DIM ALL '-------------------------------------------------------------------------------------------------- ' ** Includes ** '-------------------------------------------------------------------------------------------------- #PBFORMS BEGIN INCLUDES #IF NOT %DEF(%WINAPI) #INCLUDE "WIN32API.INC" #ENDIF #PBFORMS END INCLUDES '-------------------------------------------------------------------------------------------------- '-------------------------------------------------------------------------------------------------- ' ** Constants ** '-------------------------------------------------------------------------------------------------- #PBFORMS BEGIN CONSTANTS %IDCANCEL = 2 %IDD_DIALOG1 = 101 %IDC_LABEL1 = 1001 %IDC_LABEL2 = 1002 %IDC_LABEL3 = 1003 %IDC_LABEL4 = 1004 %IDC_NEXT = 1005 #PBFORMS END CONSTANTS '-------------------------------------------------------------------------------------------------- '-------------------------------------------------------------------------------------------------- ' ** Declarations ** '-------------------------------------------------------------------------------------------------- DECLARE CALLBACK FUNCTION ShowDIALOG1Proc() DECLARE FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG #PBFORMS DECLARATIONS '-------------------------------------------------------------------------------------------------- '-------------------------------------------------------------------------------------------------- ' ** Main Application Entry Point ** '-------------------------------------------------------------------------------------------------- FUNCTION PBMAIN() ShowDIALOG1 %HWND_DESKTOP END FUNCTION '-------------------------------------------------------------------------------------------------- '-------------------------------------------------------------------------------------------------- ' ** CallBacks ** '-------------------------------------------------------------------------------------------------- CALLBACK FUNCTION ShowDIALOG1Proc() LOCAL statement,ss AS STRING STATIC index AS LONG statement="These two labels are the same only different, can you tell? SELECT CASE AS LONG CBMSG CASE %WM_INITDIALOG ' Initialization handler CASE %WM_NCACTIVATE STATIC hWndSaveFocus AS DWORD IF ISFALSE CBWPARAM THEN ' Save control focus hWndSaveFocus = GetFocus() ELSEIF hWndSaveFocus THEN ' Restore control focus SetFocus(hWndSaveFocus) hWndSaveFocus = 0 END IF CASE %WM_COMMAND ' Process control notifications SELECT CASE AS LONG CBCTL CASE %IDC_LABEL1 CASE %IDC_LABEL2 CASE %IDC_LABEL3 CASE %IDC_LABEL4 CASE %IDC_NEXT IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN INCR index ss=PARSE$(statement," ",index) CONTROL SET TEXT CB.HNDL, %IDC_LABEL2, "" CONTROL REDRAW CB.HNDL, %IDC_LABEL2 CONTROL SET TEXT CB.HNDL, %IDC_LABEL2, ss CONTROL SET TEXT CB.HNDL, %IDC_LABEL4, "" CONTROL REDRAW CB.HNDL, %IDC_LABEL4 CONTROL SET TEXT CB.HNDL, %IDC_LABEL4, ss IF index=11 THEN index=0 'MSGBOX "%IDC_NEXT=" + FORMAT$(%IDC_NEXT), %MB_TASKMODAL END IF CASE %IDCANCEL IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN DIALOG END CBHNDL, 0 END IF END SELECT END SELECT END FUNCTION '-------------------------------------------------------------------------------------------------- '-------------------------------------------------------------------------------------------------- ' ** Dialogs ** '-------------------------------------------------------------------------------------------------- FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG LOCAL lRslt AS LONG #PBFORMS BEGIN DIALOG %IDD_DIALOG1->-> LOCAL hDlg AS DWORD DIALOG NEW hParent, "%SS_SIMPLE FUN", 215, 76, 524, 121, %WS_POPUP OR %WS_BORDER OR _ %WS_DLGFRAME OR %WS_SYSMENU OR %WS_CLIPSIBLINGS OR %WS_VISIBLE OR %DS_ABSALIGN OR _ %DS_MODALFRAME OR %DS_3DLOOK OR %DS_NOFAILCREATE OR %DS_SETFONT, %WS_EX_CONTROLPARENT OR _ %WS_EX_LEFT OR %WS_EX_LTRREADING OR %WS_EX_RIGHTSCROLLBAR, TO hDlg CONTROL ADD LABEL, hDlg, %IDC_LABEL1, "With %SS_SIMPLE", 5, 10, 100, 10 CONTROL ADD LABEL, hDlg, %IDC_LABEL2, "", 5, 20, 200, 15, %WS_CHILD OR %WS_VISIBLE OR %SS_LEFT _ OR %SS_CENTERIMAGE OR %SS_SIMPLE, %WS_EX_LEFT OR %WS_EX_LTRREADING CONTROL SET COLOR hDlg, %IDC_LABEL2, -1, %LTGRAY CONTROL ADD LABEL, hDlg, %IDC_LABEL3, "Without %SS_Simple", 5, 40, 100, 10 CONTROL ADD LABEL, hDlg, %IDC_LABEL4, "", 5, 50, 200, 15, %WS_CHILD OR %WS_VISIBLE OR %SS_LEFT _ OR %SS_CENTERIMAGE, %WS_EX_LEFT OR %WS_EX_LTRREADING CONTROL SET COLOR hDlg, %IDC_LABEL4, -1, %LTGRAY CONTROL ADD BUTTON, hDlg, %IDC_NEXT, "NEXT", 10, 75, 50, 15 CONTROL ADD BUTTON, hDlg, %IDCANCEL, "QUIT", 10, 95, 50, 15 #PBFORMS END DIALOG DIALOG SHOW MODAL hDlg, CALL ShowDIALOG1Proc TO lRslt #PBFORMS BEGIN CLEANUP %IDD_DIALOG1 #PBFORMS END CLEANUP FUNCTION = lRslt END FUNCTION '--------------------------------------------------------------------------------------------------
Comment