Jose,
I believe I have posted about this before when using Pb FireFly and when trying to duplicate the presentation using SDK.
I have always used two static's in a resource dialog as in this image for displaying a file path/name.
I have tried a number styles and exstyles.
Is it possible with CWindow and I have not hit upon the right combinations?
outer:
CONTROL " Dialog Rc File",IDC_STC2,"Static",WS_CHILDWINDOW|WS_VISIBLE|WS_DLGFRAME,10,12,346,41
inner:
CONTROL "",IDC_STC3,"Static",WS_CHILDWINDOW|WS_VISIBLE,18,29,298,13,WS_EX_CLIENTEDGE
James
Of course it's possible, but it is not a matter of control styles, but of making the second label child of the first one.
#define UNICODE
#INCLUDE ONCE "Afx/CWindow.inc"
USING Afx
DECLARE FUNCTION WinMain (BYVAL hInstance AS HINSTANCE, _
BYVAL hPrevInstance AS HINSTANCE, _
BYVAL szCmdLine AS ZSTRING PTR, _
BYVAL nCmdShow AS LONG) AS LONG
END WinMain(GetModuleHandleW(NULL), NULL, COMMAND(), SW_NORMAL)
' // Forward declaration
DECLARE FUNCTION WndProc (BYVAL hwnd AS HWND, BYVAL uMsg AS UINT, BYVAL wParam AS WPARAM, BYVAL lParam AS LPARAM) AS LRESULT
' ========================================================================================
' Main
' ========================================================================================
FUNCTION WinMain (BYVAL hInstance AS HINSTANCE, _
BYVAL hPrevInstance AS HINSTANCE, _
BYVAL szCmdLine AS ZSTRING PTR, _
BYVAL nCmdShow AS LONG) AS LONG
' // Set process DPI aware
AfxSetProcessDPIAware
' // Create the main window
DIM pWindow AS CWindow
pWindow.Create(NULL, "CWindow with a label control", @WndProc)
pWindow.SetClientSize 400, 120
pWindow.Center
' // Add a label control
DIM hLabel AS HWND = pWindow.AddControl("Static", , -1, "Label 1", 20, 20, 360, 80, WS_CHILDWINDOW OR WS_VISIBLE OR WS_DLGFRAME)
' // Add a child label control
pWindow.AddControl("Static", hLabel, -1, "Label 2", 10, 30, 320, 23, WS_CHILDWINDOW OR WS_VISIBLE, WS_EX_CLIENTEDGE)
' // Dispatch Windows messages
FUNCTION = pWindow.DoEvents(nCmdShow)
END FUNCTION
' ========================================================================================
' ========================================================================================
' Main window callback procedure
' ========================================================================================
FUNCTION WndProc (BYVAL hwnd AS HWND, BYVAL uMsg AS UINT, BYVAL wParam AS WPARAM, BYVAL lParam AS LPARAM) AS LRESULT
SELECT CASE uMsg
CASE WM_COMMAND
SELECT CASE GET_WM_COMMAND_ID(wParam, lParam)
' // If ESC key pressed, close the application sending an WM_CLOSE message
CASE IDCANCEL
IF GET_WM_COMMAND_CMD(wParam, lParam) = BN_CLICKED THEN
SendMessageW hwnd, WM_CLOSE, 0, 0
EXIT FUNCTION
END IF
END SELECT
CASE WM_DESTROY
' // End the application
PostQuitMessage(0)
EXIT FUNCTION
END SELECT
' // Default processing of Windows messages
FUNCTION = DefWindowProcW(hWnd, uMsg, wParam, lParam)
END FUNCTION
' ========================================================================================
Jose,
Why do you have to do that with two statics while radio buttons will gladly display themselves?
James
pWindow.SetFont("Tahoma",10)
hWin = pWindow.Create(NULL,"Dialog Rc File To Source Code Generator", &WndProc,0,0,0,0,0x10CA0800,0x00000200)
pWindow.SetClientSize(637,272)
pWindow.Center()
pWindow.AddControl("LABEL",hWin ,IDC_STC1, "Source Type",21,124,413,116,0x50400001)
pWindow.AddControl("OPTION",hWin ,IDC_RBN1, "bc9 CWindow TCLib App",39,152,158,18,0x50010009)
pWindow.AddControl("OPTION",hWin ,IDC_RBN2, "bc9 SDK App",39,176,175,18,0x50010009)
pWindow.AddControl("OPTION",hWin ,IDC_RBN3, "bc9 CWindow App",238,152,158,18,0x50010009)
pWindow.AddControl("OPTION",hWin ,IDC_RBN4, "FreeBasic CWindow App",238,176,168,18,0x50010009)
pWindow.AddControl("LABEL",hWin ,IDC_STC2, "Dialog Rc File",18,24,606,82,0x54400000)
pWindow.AddControl("LABEL",hWin ,IDC_STC3, "",32,58,522,26,0x50000200,0x00000200)
pWindow.AddControl("BUTTON",hWin ,IDC_GET_FILE, "...",567,58,35,26,0x50010000)
pWindow.AddControl("BUTTON",hWin ,IDC_CREATE_SOURCE, "Create Source",511,128,112,38,0x50010000)
pWindow.AddControl("BUTTON",hWin ,IDC_CANCEL, "Dismiss",511,200,112,38,0x50010000)
pWindow.AddControl("OPTION",hWin ,IDC_RBN5, "PowerBASIC CWindow App",39,200,175,18,0x50010009)
pWindow.AddControl("OPTION",hWin ,IDC_RBN6, "PowerBASIC SDK App",238,200,175,18,0x50010009)
iRetVal = pWindow.Do_Events(CmdShow)
Function = iRetVal
I don't know.
Jose,
Got it.
Dropped the exstyle on IDC_STC3 and added SS_SUNKEN to Style then flip-flopped the order
with IDC_STC3 created before IDC_STC2 first.
James
Dim As int iRetVal
Dim As HWND hWin
Raw As CWindow pWindow
pWindow.SetFont("Tahoma",10)
hWin = pWindow.Create(NULL,"Dialog Rc File To Source Code Generator", &WndProc,0,0,0,0,0x10CA0800,0x00000200)
pWindow.SetClientSize(637,272)
pWindow.Center()
pWindow.AddControl("LABEL",hWin ,IDC_STC1, "Source Type",21,124,413,116,0x50400001)
pWindow.AddControl("OPTION",hWin ,IDC_RBN1, "bc9 CWindow TCLib App",39,152,158,18,0x50010009)
pWindow.AddControl("OPTION",hWin ,IDC_RBN2, "bc9 SDK App",39,176,175,18,0x50010009)
pWindow.AddControl("OPTION",hWin ,IDC_RBN3, "bc9 CWindow App",238,152,158,18,0x50010009)
pWindow.AddControl("OPTION",hWin ,IDC_RBN4, "FreeBasic CWindow App",238,176,168,18,0x50010009)
pWindow.AddControl("LABEL",hWin ,IDC_STC3, "",32,58,522,26,0x50001200)
pWindow.AddControl("LABEL",hWin ,IDC_STC2, "Dialog Rc File",18,24,606,82,0x54400000)
pWindow.AddControl("BUTTON",hWin ,IDC_GET_FILE, "...",567,58,35,26,0x50010000)
pWindow.AddControl("BUTTON",hWin ,IDC_CREATE_SOURCE, "Create Source",511,128,112,38,0x50010000)
pWindow.AddControl("BUTTON",hWin ,IDC_CANCEL, "Dismiss",511,200,112,38,0x50010000)
pWindow.AddControl("OPTION",hWin ,IDC_RBN5, "PowerBASIC CWindow App",39,200,175,18,0x50010009)
pWindow.AddControl("OPTION",hWin ,IDC_RBN6, "PowerBASIC SDK App",238,200,175,18,0x50010009)
iRetVal = pWindow.Do_Events(CmdShow)
Function = iRetVal