Scrollable (Vertical) Text Window

Started by KeithW, October 20, 2025, 04:47:29 PM

Previous topic - Next topic

KeithW

Greetings,

I have not been able to find any direct information for this situation, so any direction would be most appreciated.

I have a large amount of text loaded into a variable, that if I display with a Message() it displays it all, but the print is very small and I have a huge monitor. If I used the BoxOpen() or BoxText() the content gets cut off.  I would like to be able to have a window to be able to display the information and a vertical scroll-bar for the user to move back & forth thru the contents.  Does WB provide or this or has anybody crossed this bridge?

Regards,
Keith

td

See the Dialog function documenation. There is a lot of it. It can handle your text if you use the correct controls.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

JTaylor

Multiline Dialog Text Box Control might be something to consider.  Although I can't remember if it does a horizontal scroll.

Jim

spl

Maybe OT:, but could send var to clipboard and paste into notepad. Gives user scroll, save, edit options.
Stan - formerly stanl [ex-Pundit]

td

A REPORTVIEW control is another possibility.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

KeithW

This is kind of a HELP text for the program... I was trying to avoid a separate HELP file and had built this rather long text variable based on conditions going on within the program.  I wanted the user to be able to view it and as I said it is getting quite long and a vertical scrolling window is what I need... it is formatted not to need horizontal scrolling capabilities.  I would like to restrict the window to a more reasonable height and then have the scroll bar for moving thru the contents.

td

The REPORTVIEW and MULTILINE controls have vertical scrollbars. The REPORTVIEW dialog control has a limitation on line length (2049 characters?) and will truncate any line that is too long to fit the width of the control's client area. The MULTIINE control does not have either restriction. It will wrap lines too long to display on a single line in the control's client area.
SomeFile = 'C:\temp\WinBatch Setup.Log'  ; A big file with long lines.
Terminate(!FileExist(SomeFile),'File Not Found', SomeFile)
Contents = FileGet(SomeFile)

;; Generated by the WIL Dialog Editor.
FileViewerFormat=`WWWDLGED,6.2`

FileViewerCaption=`File Contents`
FileViewerX=758
FileViewerY=218
FileViewerWidth=435
FileViewerHeight=246
FileViewerNumControls=002
FileViewerProcedure=`DEFAULT`
FileViewerFont=`DEFAULT`
FileViewerTextColor=`DEFAULT`
FileViewerBackground=`DEFAULT,DEFAULT`
FileViewerConfig=0
FileViewerDPI=`216,10,20`

FileViewer001=`196,218,057,019,PUSHBUTTON,"PushButton_OK",DEFAULT,"Done",1,10,@csDefButton,DEFAULT,DEFAULT,DEFAULT`
FileViewer002=`009,010,415,187,MULTILINEBOX,"MultiLineBox_1",Contents,"Multiline edit 1",DEFAULT,20,DEFAULT,DEFAULT,DEFAULT,DEFAULT`

Whatever=Dialog("FileViewer")
exit
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

KeithW

T H A N K - Y O U  Tony !!

With some tweaks I was able to get exactly what I was looking for.
MULTILINE is perfect !!

Regards,
Keith

kdmoyers

Thanks Tony -- a great reminder for me that a fast dialog can be a great solution.
-K
The mind is everything; What you think, you become.

td

Quote from: KeithW on October 21, 2025, 09:26:56 AMWith some tweaks I was able to get exactly what I was looking for.
MULTILINE is perfect !!

If it is important to prevent editing and you haven't done it already, you can add the @csReadOnly style to the MULTILINE control.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

KeithW

Didn't, but will look into it, if they edit, it will be lost anyway cause I make no attempt to save what I displayed.  Not the intent of that info, but sometimes you have to protect the user from themselves (developers, too).

Keith

JTaylor

I know you have a solution but something to remember, if you wanted formatted text, you could use a COM Control and something like Shell.Explorer.2 and that would give you HTML capabilities.

Jim

td

As you pointed out, the OP appears to be satisfied, but here is a simple example for the curious. It, hopefully, demonstrates how to display an HTML file in a WIL dialog using a COMCONTROL dialog control.

ExamFormat=`WWWDLGED,6.1`

ExamCaption=`HTML Example`
ExamX=150
ExamY=058
ExamWidth=200
ExamHeight=177
ExamNumControls=003
ExamProcedure=`DEFAULT`
ExamFont=`DEFAULT`
ExamTextColor=`DEFAULT`
ExamBackground=`DEFAULT,DEFAULT`
ExamConfig=0
ExamDPI='96,8,16'

Exam001=`009,003,178,144,COMCONTROL,DEFAULT,"file://c:/temp/junk.html",DEFAULT,1,DEFAULT,DEFAULT,DEFAULT,DEFAULT` 
Exam002=`021,153,060,012,PUSHBUTTON,DEFAULT,"OK",1,2,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
Exam003=`107,153,058,012,PUSHBUTTON,DEFAULT,"Cancel",2,3,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
Dialog("Exam")

Exit
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

kdmoyers

The mind is everything; What you think, you become.

spl

All great! But can the OP explain whether the pop-up, reportview, etc.. should be synchronous or asynchronous. Scrolling a message is not Rocket Science, but scrolling a log is a bit more complicated.
Stan - formerly stanl [ex-Pundit]

JTaylor

To expand, just for general information regarding COMCONTROL, in case it opens more possibilities, I am not certain what the straight COMCONTROL can handle as I always used Shell.Explorer.2, as I always wanted DOM access, but, assuming things are installed, it will also display Excel and Word Documents.

Jim

td

"Shell.Explorer.2" is a "programmatic identifier" and "file://" is a "moniker".  When using a moniker that points to HTML content, you end up with the misnamed "Microsoft Web Browser" control (MSFT's name, not mine), a.ka. "Shell.Explorer.2".  Loading Excel into the COMCONTROL can be tricky, depending on how the system running the script is set up. Yes, I know it can work, but it can also lead to the "Navigation to the webpage was canceled" error.

The only advantage of using a file moniker is simplicity.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

spl

While loading Excel into a COMCONTROL may get off-topic, would like to resolve this part of the OP's post:

This is kind of a HELP text for the program... I was trying to avoid a separate HELP file and had built this rather long text variable based on conditions going on within the program.

something that is kinda something based on what's going on in a program, again does not suggest a pop-up but how that will interact with the program. I wrote a response earlier which I deleted, but did suggest maybe a balloon pop-up based on program flow.
Stan - formerly stanl [ex-Pundit]

SMF spam blocked by CleanTalk