Page 1 of 1

Presentable help window invoked from the console

Posted: Thu Sep 14, 2023 8:05 pm
by Oso
Good to see some familiar names here, after an absence from the forum for a while.

I’ve been working entirely on server-side development, consequently I have limited GUI expertise. The requirement is that I have an OpenConsole() administrative application but ideally I need to provide a pop-up window invoked by a command, showing a reasonable extent of help text. It must be something better than a requester box. I'd prefer not to display the help as console text.

Before I explain what I’ve tried, is there a known method that works well? TIA.

Re: Presentable help window invoked from the console

Posted: Fri Sep 15, 2023 3:07 am
by Bitblazer
What about a PDF viewer for DOS like MUPDF ? Or fbhelp.

Re: Presentable help window invoked from the console

Posted: Fri Sep 15, 2023 4:45 am
by Kuron
OT, but welcome back. :mrgreen:

Re: Presentable help window invoked from the console

Posted: Fri Sep 15, 2023 5:08 am
by Oso
Kuron wrote: Fri Sep 15, 2023 4:45 am OT, but welcome back. :mrgreen:
Thanks Kuron 😀

Re: Presentable help window invoked from the console

Posted: Fri Sep 15, 2023 5:27 am
by Oso
Bitblazer wrote: Fri Sep 15, 2023 3:07 am What about a PDF viewer for DOS like MUPDF ? Or fbhelp.
Thanks for the ideas Bitblazer. I'd prefer to develop the code for the help, to keep this self-contained. I tried this :

Code: Select all

helpwin.i = OpenWindow(#PB_Any, 50, 30, 1200, 600, "User's Help", #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)
Is there a gadget available that offers scrollable text within it, such as with a vertical scrollbar?

Re: Presentable help window invoked from the console

Posted: Fri Sep 15, 2023 7:55 am
by idle
Hi Oso,

Maybe just open a window with an editor gadget and set it to read only and word wrap.

Re: Presentable help window invoked from the console

Posted: Fri Sep 15, 2023 10:04 am
by Oso
idle wrote: Fri Sep 15, 2023 7:55 am Hi Oso, Maybe just open a window with an editor gadget and set it to read only and word wrap.
Hi Idle, thanks for this and hope you're okay. This works beautifully well, including the scrolling, simple but effective. Hopefully I've got this right :

Code: Select all

helpwin.i = OpenWindow(#PB_Any, 200, 300, 500, 200, "User Help Guide", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
helpdsp.i = EditorGadget(#PB_Any, 0, 0, 500, 200, #PB_Editor_ReadOnly | #PB_Editor_WordWrap)
    
AddGadgetItem(helpdsp.i, -1, "User's Guide")
AddGadgetItem(helpdsp.i, -1, "")
AddGadgetItem(helpdsp.i, -1, "The keyboard shortcut keys Ctrl + C (Copy), Ctrl + X (Cut) and Ctrl + V (Paste) can be used for editing. The 'Insert' key determines whether text is inserted or overwritten. The Delete key deletes characters to the right of the cursor.  Holding down the Shift key and using the arrow keys, selects text.")
AddGadgetItem(helpdsp.i, -1, "")
AddGadgetItem(helpdsp.i, -1, "To exit from the console session, press F10.")
    
Repeat
  ; Delay(50) * Removed
Until WaitWindowEvent() = #PB_Event_CloseWindow
CloseWindow(helpwin.i)
Image

Re: Presentable help window invoked from the console

Posted: Fri Sep 15, 2023 10:14 am
by idle
Yes that good but you don't need to delay its waiting

Re: Presentable help window invoked from the console

Posted: Fri Sep 15, 2023 10:22 am
by Oso
idle wrote: Fri Sep 15, 2023 10:14 am Yes that good but you don't need to delay its waiting
That's interesting, you're right, it works fine without. EDIT: I'd omitted CloseWindow() in one of my tests — it didn't like that and I assumed at first it needed a delay.