Kinda cool though. Can make an "invisible" button in that the Callback still detects a click in the area where the faux button (Label) is drawn.
'
Code:
'PBWIN 9.01 - WinApi 05/2008 - XP Pro SP3 #Dim All #Compile Exe #Optimize SPEED #Debug Display On'off for production code #Include "WIN32API.INC" #Include "COMDLG32.INC" #Include "InitCtrl.inc" ' Global hdlg As Dword %Id_Exit_Btn = 1000 %Id_Label01 = 1001 %Id_Show_Result_Btn = 1002 ' Macro Common_Locals 'Macro easier than retyping and maintains coding consistency Global Dlg_hght, Dlg_Wd As Long 'Global in case want to use in Controls Local Stile, Row, col, hght, wd, Longest,ctr, ln, ln1, i As Long Local l, s As String End Macro ' CallBack Function Dialog_Processor Common_Locals Select Case CbMsg 'This is TO determine the message TYPE ' Case %WM_INITDIALOG'<- Initialiaton when the program loads ' Case %WM_SYSCOMMAND 'Traps Any Alt key but only F4 closes ' Case %WM_COMMAND 'This processes command messages Select Case CbCtl Case %Id_Label01 ? "Label01 clicked", , FuncName$ Case %Id_Exit_Btn Select Case CbCtlMsg Case 0 Dialog End CbHndl 'Applikation beenden End Select End Select End Select End Function ' Function PBMain Common_Locals Stile = Stile Or %WS_CAPTION Stile = Stile Or %WS_SYSMENU Stile = Stile Or %WS_THICKFRAME Stile = Stile Or %WM_HELP Stile = Stile Or %WS_Border 'doesn't do anything Dlg_hght = 400 Dlg_Wd = 400 Dialog New Pixels, hdlg, "Demo", , , Dlg_Wd, Dlg_Hght, Stile To hdlg 'centered Row = 10 col = 10 Wd = 100 Hght = 25 Reset stile Stile = stile Or %ss_Notify Stile = Stile Or %ss_Center ' ' [COLOR=red]To see the different effects, (un)rem the Etch stiles.[/COLOR] ' Stile = Stile Or %ss_EtchedHorz [COLOR=red]'only shws a line[/COLOR] ' Stile = Stile Or %ss_EtchedVert '[COLOR=red] ""[/COLOR] Stile = Stile Or %ss_EtchedFrame [COLOR=red]'shows nothing?[/COLOR] s$ = " I am a button. " Control Add Label, hdlg, %Id_Label01, s$ & "z", Col, Row, Wd, Hght, stile Control Set Text hdlg, %Id_Label01, s$ & "Y" [COLOR=red]'overwrite Etching? - Nope[/COLOR] Control Set Color hdlg, %Id_Label01, -1, %Yellow Col = col + wd + 10 Control Add Button, hdlg, %Id_Show_Result_Btn, s$ & "x", col, row, Wd, Hght Row = Dlg_hght - Hght - 2 'Just off bottom Control Add Button, hdlg, %Id_Exit_Btn, "Abandon Ship", col, row, Wd, Hght Control Set Focus hdlg, %Id_Exit_Btn Dialog Show Modal hDlg Call Dialog_Processor End Function 'Applikation beenden '
"The man who goes alone can start today;
but he who travels with another
must wait till that other is ready."
Henry David Thoreau (1817-1862)
=========================================
Leave a comment: