Author Topic: BCX Dialog  (Read 41 times)

Ad_Rienks

  • Newbie
  • *
  • Posts: 22
    • View Profile
BCX Dialog
« on: September 16, 2022, 04:11:41 PM »
Hello,

I have this modeless dialog, that should be called as a sort of help when a menu item is choosen, or a button is clicked.

Code: [Select]
BEGIN DIALOG AS License ' Modeless Dialog or Modal Dialog ?
  STATIC LicEd AS CONTROL
  STATIC LicBtn AS CONTROL
SELECT CASE cbmsg
CASE WM_INITDIALOG
                        LicEd = BCX_EDIT("", hWnd, 109, 4, 4, 142, 195, WS_CHILD | WS_VISIBLE | ES_READONLY | ES_MULTILINE)
' modstyle(LicEd, WS_VSCROLL)
editloadfile(LicEd, "help.txt")
LicBtn = bcx_button("Close", hWnd, 110, 4, 200, 40, 10)
END select
IF cbctl = 110 THEN ' button LicBtn is hit
CloseDialog
END IF
END DIALOG

When the dialog is called, it flashes and disappears immediately, as if the button was pressed. The code is almost the same as I've seen in other programs.
What is wrong with this code?
The dialog opens as it should, as I want it to see, if I leave out the '110' ID

Thanks for any explanation to this newbie question.

MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 1369
    • View Profile
Re: BCX Dialog
« Reply #1 on: September 16, 2022, 05:31:43 PM »
Ad ... This works as expected. 

Code: [Select]

GUI "LICENSE"

SUB FORMLOAD
    BCX_MDIALOG( License, "License App", 0, 0, 0, 150, 225)
    PostQuitMessage(0)
END SUB


BEGIN EVENTS
END EVENTS



BEGIN MODAL DIALOG AS License ' Modeless Dialog or Modal Dialog ?
    STATIC LicEd AS CONTROL
    STATIC LicBtn AS CONTROL

    SELECT CASE CBMSG
        CASE WM_INITDIALOG
        LicEd = BCX_EDIT("", hWnd, 109, 4, 4, 142, 195, WS_CHILD | WS_VISIBLE | ES_READONLY | ES_MULTILINE)
        ' modstyle(LicEd, WS_VSCROLL)
        EDITLOADFILE(LicEd, "help.txt")
        LicBtn = BCX_BUTTON("Close", hWnd, 110, 4, 200, 40, 10)
        SHOW CBHWND

        CASE WM_COMMAND
        SELECT CASE CBCTL
            CASE 110 ' button LicBtn is hit
            CLOSEDIALOG
        END SELECT
    END SELECT
END DIALOG