Jump to content

Recommended Posts

Posted

Hello,

I have a major program with

  1. - one GUI (main program, main function buttons and some controls), fix hard size,
  2. - and a splashtext window (fix hard size 800 * 600).

The main functions have their own child windows, input controls and messagebox outputs, and the splashtext window is used for outputs to the user (type of protocol), just to know what's going on (progress bars, function names, delay times etc.) - and for debugging purposes. Until now everthing is doing fine.

But: it's a major project, some years old and I got it from a colleague. By now it has app. 8000 lines of code, app. 100 functions, and all of them are doing output to the splashtext window. Today the splashtext window is becoming too small (size ist fix) - not enough lines can be displayed (they vanish). Max string size of output (2 giga) is NEVER reached.

Our standard code is like this:

Quote

; Protokollfenster starten... --------------------
$bt_out_text = "...Tool ist gestartet..."
$gprot_wnd = SplashTextOn($bt_title_text & " --- Protokollierung --- " & $g_heute & " - " & $g_jetzt, $bt_out_text, 800, 600, 100, 100, $DLG_NOTONTOP+$DLG_TEXTLEFT+$DLG_MOVEABLE, "Arial", 12, 400)

; Standard Textausgabe...
$bt_out_text = $bt_out_text & @CRLF & "   lies_cfg_file() running..."
ControlSetText($bt_title_text, "", "Static1", $bt_out_text)

 

Is there an easy or simple way to get scrollbars into the splashtext window -- or a smart replacement for splashtext ?

By now the window can do about 30 lines of text (every single output is added to the text string), we need about 50 lines (or more) as the program (and functions) is growing.

The only thing I've found on the web was that (unanswered) topic from 2017:

Thanks for some hints (and please apologize my English; I'm german with little practise).

Posted

Right, that would be the standard solution (own GUI with editbox readonly or listbox nosel). I didn't give consideration to that because its too much effort (too many functions have to be modfied) and the risk to produce new errors is too high. Besides that I have a lot of interdependent GUIs and controls with some tricky solutions (it's too damageable).

So there's no chance to add a scrollbar to splashtexton() ?

Maybe I will have to implement an alternative: use of a private_controlsettext function (just some renames...) as a software layer between. Doing a "virtual" vertical scroll - remove the oldest (topmost) line; check the leftmost position of CRLF in the output string, do a stringright() with the rest -- and put it out.

Or does anybody have another idea ?

Posted

If you do not want to complicate your code, why not make a second executable that will act as a splash screen that can read something hidden on your main gui?

Example:

On your main program, make a label that is only 1 pixel by 1 pixel like this:

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$Form2 = GUICreate("Form1", 405, 294)
$Label1 = GUICtrlCreateLabel("", 1, 1, 1, 1)
GUISetState(@SW_SHOW)

$textToBeRead = "Monkey is a common name that may refer to groups or species of mammals, " & _
"in part, the simians of infraorder Simiiformes. The term is applied descriptively to groups " & _
"of primates, such as families of New World monkeys and Old World monkeysand Hominoidea " & _
"emerged within the catarrhine monkeys some 25 million years ago. Extinct basal simians " & _
"such as Aegyptopithecus or Parapithecus [35-32 million years ago], eosimiidea and sometimes " & _
"even the Catarrhini group are also considered monkeys by primatologists."

GUICtrlSetData($Label1, $textToBeRead)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Then make a second executable that reads the text from the first:

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>



$Form2 = GUICreate("Form2", 622, 204, 302, 218)
$Label1 = GUICtrlCreateLabel("", 8, 8, 604, 185)
GUISetState(@SW_SHOW)

$textread = ControlGetText("Form1", "", "[CLASS:Static;INSTANCE:1]")
GUICtrlSetData($Label1, $textread)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

It's not pretty at the moment, but it works. You can play with the code to make the splash screen look better. And being a totally separate .exe, it won't interfere with your existing code at all.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...