Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Extended message box
#4
Horizontal scroll is only a possibility, not a requirement.

The example code I have is in Purebasic, do you still want to see it?

I just remembered I also have a "Tinyscreendialog" which is not the implementation used by QB64PE, but was a Freebasic "library" by someone else. It was by one of the early contributors of the QB64 Wiki. Allowed to build simple dialogs much like Autohotkey. With that I was able to build an extended message box which had a text field that could scroll vertically, and otherwise "OK" button.

Code: (Select All)
Procedure MessageWindow(Titel.s, Text.s)
    xwidth = 320
    xheight = 160
    ewindow = OpenWindow(#PB_Any, 0, 0, xwidth, xheight, Titel, #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    If ewindow
        pip = 0
        Repeat
            pip = FindString(Text, "|", pip + 1)
            If pip
                If Mid(Text, pip + 1, 1) = "0"
                    ch = Val(Mid(Text, pip + 2, 3))
                    If ch = 124: ch = 1: EndIf
                    If ch
                        Text = Left(Text, pip - 1) + Chr(ch) + Mid(Text, pip + 5)
                    EndIf
                EndIf
            EndIf
        Until pip = 0
        Text = ReplaceString(Text, "|", Chr(13) + Chr(10))
        Text = ReplaceString(Text, #SOH$, "|")
        ewindowcontent = StringGadget(#PB_Any, 0, 0, xwidth, xheight - 32, Text, #PB_String_ReadOnly | #ES_MULTILINE | #PB_String_BorderLess | #WS_VSCROLL | #WS_HSCROLL)
        okbut = ButtonGadget(#PB_Any, xwidth / 2 - 60, xheight - 28, 120, 28, "OK")
        Repeat
            ev = WaitWindowEvent()
            If (ev = #PB_Event_Gadget) And (EventGadget() = okbut)
                Break
            EndIf
        Until ev = #PB_Event_CloseWindow
        CloseWindow(ewindow)
    EndIf
EndProcedure

As I've said, it was derrived from Purebasic Code Archive. The size of the dialog is hardcoded because it was meant to be a demonstration of using "any" amount of text as the message. Of course it could be made larger, until the limits of the screen, up to the programmer. It uses pipe "|" character to delimit a newline, so there was no need to inject a CHR$(13). It might have to be adjusted, however, to send the right newline combination depending on operating system.

EDIT #2: AH screenshots! Will have to go back to Windows LOL and dig even deeper into my backups for an EXE file created with that programming system. Or the only program I wrote with Freebasic which only gives tag information to an OGG Vorbis file.
Reply


Messages In This Thread
Extended message box - by mnrvovrfc - 02-11-2023, 08:41 PM
RE: Extended message box - by SpriggsySpriggs - 02-13-2023, 02:12 PM
RE: Extended message box - by bplus - 02-13-2023, 05:21 PM
RE: Extended message box - by mnrvovrfc - 02-13-2023, 06:18 PM
RE: Extended message box - by mnrvovrfc - 02-13-2023, 07:21 PM
RE: Extended message box - by SpriggsySpriggs - 02-13-2023, 11:10 PM
RE: Extended message box - by vince - 02-14-2023, 12:21 AM
RE: Extended message box - by aurel - 02-14-2023, 10:03 AM
RE: Extended message box - by mnrvovrfc - 02-14-2023, 01:06 PM
RE: Extended message box - by mnrvovrfc - 08-19-2023, 11:53 PM
RE: Extended message box - by RhoSigma - 08-20-2023, 07:44 AM
RE: Extended message box - by bplus - 08-20-2023, 10:54 AM
RE: Extended message box - by mnrvovrfc - 08-20-2023, 01:42 PM



Users browsing this thread: 5 Guest(s)