PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: LABEL issues???  (Read 757 times)

James Fuller

  • FireFly3 Registered User
  • Senior FireFly Member
  • *
  • Posts: 272
  • FF3 User
LABEL issues???
« on: December 23, 2016, 12:38:35 PM »

Josť,
  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

Logged

Josť Roca

  • Moderator
  • Master FireFly Member
  • *****
  • Posts: 2732
    • Josť Roca Software
Re: LABEL issues???
« Reply #1 on: December 23, 2016, 01:48:03 PM »

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.

Code: [Select]
#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
' ========================================================================================

James Fuller

  • FireFly3 Registered User
  • Senior FireFly Member
  • *
  • Posts: 272
  • FF3 User
Re: LABEL issues???
« Reply #2 on: December 23, 2016, 03:04:47 PM »

Josť,
  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

Logged

Josť Roca

  • Moderator
  • Master FireFly Member
  • *****
  • Posts: 2732
    • Josť Roca Software
Re: LABEL issues???
« Reply #3 on: December 23, 2016, 03:35:05 PM »

I don't know.

James Fuller

  • FireFly3 Registered User
  • Senior FireFly Member
  • *
  • Posts: 272
  • FF3 User
Re: LABEL issues???
« Reply #4 on: December 23, 2016, 07:06:03 PM »

Josť,
  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
Logged