Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
program generated by chatgpt
#17
you have to keep an eye on Chat GPT because it's a horrible liar:

"Provide an example of a simple gui dialog in QB64 with maybe 2 or 3 buttons in a prompt"

DON'T RUN ME
Code: (Select All)
' Declare variables
DIM button AS INTEGER
DIM dialog AS INTEGER

' Create a button and assign it to the variable "button"
button = _CREATEPUSHBUTTON("Click Me!", 50, 50, 150, 50)

' Set the button's font and color
_SETFONT button, "Arial", 24, _FW_BOLD
_SETTEXTCOLOR button, _RGB(0, 0, 255)

' Set the button's background color
_SETBKCOLOR button, _RGB(255, 255, 255)

' Set the button's text alignment
_SETALIGNMENT button, _TA_CENTER

' Set the button's default state (unclicked)
_SETSTATE button, _STATE_NORMAL

' Set the button's hover state (when the mouse is hovering over it)
_SETHOVERSTATE button, _STATE_HOT

' Set the button's clicked state (when it is clicked)
_SETPRESSEDSTATE button, _STATE_PRESSED

' Set the button's callback function
_SETEVENT button, _EVENT_CLICK, "buttonClicked"

' Display the button
_SHOW button

' Main loop
DO
    ' Update the GUI
    _PROCESSMESSAGES

    ' Sleep for 10 milliseconds
    SLEEP 10
LOOP

' Button clicked callback function
SUB buttonClicked
    ' Create a dialog box and assign it to the variable "dialog"
    dialog = _CREATEDIALOG("Dialog", 50, 50, 300, 200)

    ' Set the dialog box's font and color
    _SETFONT dialog, "Arial", 18, _FW_NORMAL
    _SETTEXTCOLOR dialog, _RGB(0, 0, 0)

    ' Set the dialog box's background color
    _SETBKCOLOR dialog, _RGB(255, 255, 255)

    ' Set the dialog box's text
    _SETTEXT dialog, "Would you like to continue?"

    ' Add two buttons to the dialog box
    _CREATEPUSHBUTTON "Yes", 50, 100, 75, 25, _IDOK, dialog
    _CREATEPUSHBUTTON "No", 175, 100, 75, 25, _IDCANCEL, dialog

    ' Display the dialog box and wait for the user to click a button
    result = _DO(dialog)

    ' If the user clicked the "Yes" button
    IF result = _IDOK THEN
        ' Show a message box indicating that the user clicked "Yes"
        _MESSAGE "You clicked Yes!"
    END IF

    ' If the user clicked the "No" button
    IF result = _IDCANCEL THEN
        ' Show a message box indicating that the user clicked "No"
        _MESSAGE "You clicked No!"
    END IF
END SUB
Reply


Messages In This Thread
program generated by chatgpt - by James D Jarvis - 12-16-2022, 07:06 PM
RE: program generated by chatgpt - by madscijr - 12-16-2022, 08:51 PM
RE: program generated by chatgpt - by madscijr - 12-16-2022, 09:40 PM
RE: program generated by chatgpt - by Pete - 12-16-2022, 07:15 PM
RE: program generated by chatgpt - by mnrvovrfc - 12-16-2022, 10:24 PM
RE: program generated by chatgpt - by mnrvovrfc - 12-17-2022, 04:39 PM
RE: program generated by chatgpt - by Pete - 12-16-2022, 07:38 PM
RE: program generated by chatgpt - by Pete - 12-16-2022, 08:05 PM
RE: program generated by chatgpt - by madscijr - 12-16-2022, 09:44 PM
RE: program generated by chatgpt - by mnrvovrfc - 12-16-2022, 10:46 PM
RE: program generated by chatgpt - by James D Jarvis - 12-22-2022, 03:39 PM
RE: program generated by chatgpt - by mnrvovrfc - 12-22-2022, 04:52 PM



Users browsing this thread: 1 Guest(s)