Jump to content

Unable to create multiple Rich Edits


Recommended Posts

I am using AutoIt v3.3.8.1 for Win2K compatibility. I am trying to create a form containing multiple Rich Edits. The relevant code section is as follows:

    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <TabConstants.au3>
    #include <WindowsConstants.au3>
    #include <GuiTab.au3>
    #include <GuiEdit.au3>
    #include <GuiRichEdit.au3>
    
    ; Enforces strict variable declaration rules
    Opt("MustDeclareVars", 1)
    
    ; Initialise application
    Init()
    
    ; Function declarations
    Func Init()
      GenerateGUI()
      StartEventListener()
    EndFunc
    
    Func GenerateGUI()
      ; GUI designed via Koda FormDesigner tool
      #Region ### START Koda GUI section ### Form=
      Global $SAForm = GUICreate("", 800, 600)
      Global $SATabs = GUICtrlCreateTab(0, 0, 800, 600)
    
      Global $ConfigTab = GUICtrlCreateTabItem("Configuration Settings")
    
      Global $TestTab = GUICtrlCreateTabItem("Tests")
        Global $NetTestGrp = GUICtrlCreateGroup("Network Connectivity", 4, 25, 792, 134)
        Global $NetDestListLbl = GUICtrlCreateLabel("Destinations to Test:", 14, 51, 102, 18)
        Global $NetDestListEdit = GUICtrlCreateEdit("", 116, 48, 279, 66, _
            BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_READONLY,$ES_WANTRETURN))
        Global $NetPingResultLbl = GUICtrlCreateLabel("Ping Test Result:", 405, 51, 84, 18)
        ;Global $NetPingResultEdit = GUICtrlCreateEdit("", 489, 48, 297, 66, _
        ;    BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_READONLY,$ES_WANTRETURN,$WS_VSCROLL))
        Global $NetPingResultEdit = _GUICtrlRichEdit_Create($SAForm, "", 489, 48, 297, 66, _
            BitOR($ES_MULTILINE,$ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$WS_TABSTOP,$WS_VSCROLL), _
            BitOR($WS_EX_CLIENTEDGE,$WS_EX_TRANSPARENT))
        _GUICtrlRichEdit_SetReadOnly($NetPingResultEdit, True)
        Global $NetPingTestBtn = GUICtrlCreateButton("Start Ping Test", 350, 124, 100, 25)
    
        Global $ResUtilGrp = GUICtrlCreateGroup("Resource Utilisation", 4, 160, 792, 437)
        Global $ResDskUseLbl = GUICtrlCreateLabel("Disk Usage:", 14, 183, 61, 18)
        ;Global $ResDskUseEdit = GUICtrlCreateEdit("", 14, 201, 250, 110, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$WS_VSCROLL))
        Global $ResDskUseEdit = _GUICtrlRichEdit_Create($SAForm, "", 14, 201, 250, 110, _
            BitOR($ES_MULTILINE,$ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$WS_TABSTOP,$WS_VSCROLL), $WS_EX_CLIENTEDGE)
            ;BitOR($WS_EX_CLIENTEDGE,$WS_EX_TRANSPARENT))
        _GUICtrlRichEdit_SetReadOnly($ResDskUseEdit, True)
        Global $ResCpuUseLbl = GUICtrlCreateLabel("CPU Usage:", 275, 183, 61, 18)
        ;Global $ResCpuUseEdit = GUICtrlCreateEdit("", 275, 201, 250, 110, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$WS_VSCROLL))
        Global $ResCpuUseEdit = _GUICtrlRichEdit_Create($SAForm, "", 275, 201, 250, 110, _
            BitOR($ES_MULTILINE,$ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$WS_TABSTOP,$WS_VSCROLL), $WS_EX_CLIENTEDGE)
            ;BitOR($WS_EX_CLIENTEDGE,$WS_EX_TRANSPARENT))
        _GUICtrlRichEdit_SetReadOnly($ResCpuUseEdit, True)
        Global $ResMemUseLbl = GUICtrlCreateLabel("Memory Usage:", 536, 183, 79, 18)
        ;Global $ResMemUseEdit = GUICtrlCreateEdit("", 536, 201, 250, 110, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$WS_VSCROLL))
        Global $ResMemUseEdit = _GUICtrlRichEdit_Create($SAForm, "", 536, 201, 250, 110, _
            BitOR($ES_MULTILINE,$ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$WS_TABSTOP,$WS_VSCROLL), $WS_EX_CLIENTEDGE)
            ;BitOR($WS_EX_CLIENTEDGE,$WS_EX_TRANSPARENT))
        _GUICtrlRichEdit_SetReadOnly($ResMemUseEdit, True)
    
        ;$RUUtilBtn = GUICtrlCreateButton("Check Usage", 350, 303, 100, 25)
    
      Global $TaskTab = GUICtrlCreateTabItem("Tasks")
    
      Global $LogTab = GUICtrlCreateTabItem("Log")
        Global $LogDisplay = GUICtrlCreateEdit("", 4, 25, 792, 531, _
            BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_READONLY,$WS_HSCROLL,$WS_VSCROLL))
        Global $ExportLogBtn = GUICtrlCreateButton("Export Log", 320, 566, 75, 25)
        Global $ClearLogBtn = GUICtrlCreateButton("Clear Log", 405, 566, 75, 25)
    
      GUISetState(@SW_SHOW)
      #EndRegion ### END Koda GUI section ###
    
      _GUICtrlTab_ClickTab($SATabs, _GUICtrlTab_FindTab($SATabs, "Tests"))
    EndFunc
    
    Func StartEventListener()
      While 1
        Local $nMsg = GUIGetMsg()
        Switch $nMsg
          Case $GUI_EVENT_CLOSE
            Exit
    
          Case $SATabs
            Local $currTab = GUICtrlRead($SATabs, 1)
            If $currTab <> $lastTab Then
              If $currTab = $TestTab Then
                ControlShow($SAForm, "", $NetPingResultEdit)
              Else
                ControlHide($SAForm, "", $NetPingResultEdit)
              EndIf
            EndIf
            $lastTab = $currTab
    
          Case $NetPingTestBtn
            RunPingTest()
    
          Case $ExportLogBtn
            ExportLog()
    
        EndSwitch
      WEnd
    EndFunc

When I run the script, only the first rich edit declared is visible. The rest don't seem to have been created at all. What is the issue here and how do I rectify it?

Link to comment
Share on other sites

There's a bug in the RichEdit UDF in that version, see trak ticket about it.

https://www.autoitscript.com/trac/autoit/ticket/2211

 

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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