Jump to content
Sign in to follow this  
xtrim

GUICtrlRichEdit in Tab control

Recommended Posts

Hi,

Cant get this RichEdit box to display in in a specific tab...what am I missing?

#include <GUIConstantsEx.au3>
#include <GuiRichEdit.au3>
#include <WindowsConstants.au3>
#include <GuiStatusBar.au3>
#include <GuiEdit.au3>
#include <misc.au3>
Opt('MustDeclareVars', 1)

Example()
Func Example()
Local $tab, $tab0, $tab0OK, $tab0input
Local $tab1, $tab1combo, $tab1OK
Local $tab2, $tab2OK, $msg
local $hRichEdit,$hGui

$hGui=GUICreate("My GUI Tab", 250, 150); will create a dialog box that when displayed is centered
GUISetBkColor(0x00E0FFFF)
GUISetFont(9, 300)

$tab = GUICtrlCreateTab(10, 10, 200, 100)

$tab0 = GUICtrlCreateTabItem("tab0")
; GUICtrlCreateLabel("label0", 30, 80, 50, 20)
; $tab0OK = GUICtrlCreateButton("OK0", 20, 50, 50, 20)
; $tab0input = GUICtrlCreateInput("default", 80, 50, 70, 20)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "ss", 80, 50, 70, 20, BitOR($ES_MULTILINE, $WS_VSCROLL))

$tab1 = GUICtrlCreateTabItem("tab----1")
GUICtrlCreateLabel("label1", 30, 80, 50, 20)
$tab1combo = GUICtrlCreateCombo("", 20, 50, 60, 120)
GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo", "Jon"); default Jon
$tab1OK = GUICtrlCreateButton("OK1", 80, 50, 50, 20)

$tab2 = GUICtrlCreateTabItem("tab2")
GUICtrlSetState(-1, $GUI_SHOW); will be display first
GUICtrlCreateLabel("labeqqqql2", 30, 80, 50, 20)
$tab2OK = GUICtrlCreateButton("OK2", 140, 50, 50)

GUICtrlCreateTabItem(""); end tabitem definition
GUICtrlCreateLabel("Click on tab and see the title", 20, 130, 250, 20)
GUISetState()

; Run the GUI until the dialog is closed
While 1
  $msg = GUIGetMsg()
  If $msg = $GUI_EVENT_CLOSE Then ExitLoop
  If $msg = $tab Then
   ; display the clicked tab
   WinSetTitle("My GUI Tab", "", "My GUI Tab" & GUICtrlRead($tab))
  EndIf
WEnd
EndFunc   ;==>Example

tnx ;)

E.

Share this post


Link to post
Share on other sites

I don't know, but since it seems not to show, maybe you could do this for the moment to get round it.

#include <GUIConstantsEx.au3>
#include <GuiRichEdit.au3>
#include <WindowsConstants.au3>
#include <GuiStatusBar.au3>
#include <GuiEdit.au3>
#include <misc.au3>
;Opt('MustDeclareVars', 1)

Example()
Func Example()
Local $tab, $tab0, $tab0OK, $tab0input
Local $tab1, $tab1combo, $tab1OK
Local $tab2, $tab2OK, $msg
local $hRichEdit,$hGui

$hGui=GUICreate("My GUI Tab", 250, 150); will create a dialog box that when displayed is centered
GUISetBkColor(0x00E0FFFF)
GUISetFont(9, 300)
$ch1 = GUICreate("",192,70,12,34,$WS_CHILD,-1,$hGui)

$hRichEdit = _GUICtrlRichEdit_Create($ch1, "ss", 0, 0, 190, 68);, BitOR($ES_MULTILINE, $WS_VSCROLL))
GUISetState()
GUISwitch($hGui)
$tab = GUICtrlCreateTab(10, 10, 200, 100)

$tab0 = GUICtrlCreateTabItem("tab0")

$tab1 = GUICtrlCreateTabItem("tab----1")
GUICtrlCreateLabel("label1", 30, 80, 50, 20)
$tab1combo = GUICtrlCreateCombo("", 20, 50, 60, 120)
GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo", "Jon"); default Jon
$tab1OK = GUICtrlCreateButton("OK1", 80, 50, 50, 20)

$tab2 = GUICtrlCreateTabItem("tab2")
;GUICtrlSetState(-1, $GUI_SHOW); will be display first
GUICtrlCreateLabel("labeqqqql2", 30, 80, 50, 20)
$tab2OK = GUICtrlCreateButton("OK2", 140, 50, 50)

GUICtrlCreateTabItem(""); end tabitem definition
GUICtrlCreateLabel("Click on tab and see the title", 20, 130, 250, 20)
GUISetState()

; Run the GUI until the dialog is closed
While 1
  $msg = GUIGetMsg()
  If $msg = $GUI_EVENT_CLOSE Then ExitLoop
  If $msg = $tab Then
   ; display the clicked tab
   WinSetTitle("My GUI Tab", "", "My GUI Tab" & GUICtrlRead($tab))
   if guictrlread($tab) = 0 Then
       GUISetState(@SW_SHOW,$ch1)
   Else
       GUISetState(@SW_HIDE, $ch1)
       EndIf
  EndIf
WEnd
EndFunc   ;==>Example

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

xtrim,

The Tabs tutorial in the Wiki will explain all. ;)

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

I borrowed the example above and can't seem to understand why is this not working as it should.  I followed the instructions in the wiki in regards to hiding UDF controls when used on an internal Tab, but it still bleeds through.

#include <GUIConstantsEx.au3>
#include <GuiRichEdit.au3>
#include <GuiTab.au3>
#include <WindowsConstants.au3>
#include <GuiStatusBar.au3>
#include <GuiEdit.au3>
#include <misc.au3>
#include <GuiRichEdit.au3>
Opt('MustDeclareVars', 1)

Example()
Func Example()
    Global $tab, $tab0, $tab0OK, $tab0input
    Global $tab1, $tab1combo, $tab1OK
    Global $tab2, $tab2OK, $msg
    Global $hRichEdit, $hGui

    $hGui = GUICreate("My GUI Tab", 250, 150); will create a dialog box that when displayed is centered
    GUISetBkColor(0x00E0FFFF)
    GUISetFont(9, 300)

    $tab = GUICtrlCreateTab(10, 10, 200, 100)

    $tab0 = GUICtrlCreateTabItem("tab0")
    ; GUICtrlCreateLabel("label0", 30, 80, 50, 20)
    ; $tab0OK = GUICtrlCreateButton("OK0", 20, 50, 50, 20)
    ; $tab0input = GUICtrlCreateInput("default", 80, 50, 70, 20)
    $hRichEdit = _GUICtrlRichEdit_Create($hGui, "ss", 80, 50, 70, 20, BitOR($ES_MULTILINE, $WS_VSCROLL))


    $tab1 = GUICtrlCreateTabItem("tab----1")
    GUICtrlCreateLabel("label1", 30, 80, 50, 20)
    $tab1combo = GUICtrlCreateCombo("", 20, 50, 60, 120)
    GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo", "Jon"); default Jon
    $tab1OK = GUICtrlCreateButton("OK1", 80, 50, 50, 20)

    $tab2 = GUICtrlCreateTabItem("tab2")
    GUICtrlSetState(-1, $GUI_SHOW); will be display first
    GUICtrlCreateLabel("labeqqqql2", 30, 80, 50, 20)
    $tab2OK = GUICtrlCreateButton("OK2", 140, 50, 50)

    GUICtrlCreateTabItem(""); end tabitem definition
    GUICtrlCreateLabel("Click on tab and see the title", 20, 130, 250, 20)
    GUISetState()

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
        If $msg = $tab Then
            ; display the clicked tab
            WinSetTitle("My GUI Tab", "", "My GUI Tab" & GUICtrlRead($tab))
        If _GUICtrlTab_GetCurSel($tab) = 0 Then
            GUISetState(@SW_SHOW, $hRichEdit)
        Else
            GUISetState(@SW_HIDE, $hRichEdit)
        EndIf
                EndIf
    WEnd
EndFunc   ;==>Example
_GUICtrlRichEdit_Destroy($hRichEdit)

Share this post


Link to post
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
Sign in to follow this  

  • Similar Content

    • By rudi
      Hi,
      from other postings here as a start I'm quite Close to my Goal of putting formatted text to the clipboard:
      #include-once #include <GUIConstantsEx.au3> #include <GuiRichEdit.au3> #include <WindowsConstants.au3> Global $g_idLblMsg, $g_hRichEdit Example("The first text will be formatted ""as is""" & @CRLF & _ "(Default Font and font size)", "This text is formatted differently") MsgBox(0, "Rich Text copied", "Formatted Text put to clipboard") Func Example($TextDefault, $TextCourier) Local $hGui, $iMsg, $idBtnNext, $iStep = 0 $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName, StringLen(".exe")) & ")", 320, 350, -1, -1) $g_hRichEdit = _GUICtrlRichEdit_Create($hGui, $TextDefault, 10, 10, 300, 220, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL)) $g_idLblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60) GUISetState(@SW_SHOW) _GUICtrlRichEdit_SetSel($g_hRichEdit, -1, -1) ; set selection behind last CHAR in RTF_EDIT _GUICtrlRichEdit_SetFont($g_hRichEdit, 8, "Courier New") ; change font to 8pt, Courier New _GUICtrlRichEdit_AppendText($g_hRichEdit, @CRLF & $TextCourier) _GUICtrlRichEdit_SetSel($g_hRichEdit, 0, -1) ; select all the content of the RTF_EDIT _GUICtrlRichEdit_Copy($g_hRichEdit) ; put the selection to the clipboard EndFunc ;==>Example  
      Finally the clipboard content has to hold pre-formatted data to be pasted into an email body. for the 2nd part I'd like to add a frame around the text, like I did manually before taking this screenshot.



      Any suggestions, or maybe some absolutely different Approach?
       
      CU, Rudi.
    • By Blois
      Hi Guis,
       
      I need to create keyboard shortcut to navigate the tabs and activate them, but I could not use the code below:
      #include <TabConstants.au3> #include <WindowsConstants.au3> #include <GuiTab.au3> #include <GUIConstantsEx.au3> HotKeySet("^{TAB}", "_TabRight") HotKeySet("^+{TAB}", "_TabLeft") $gui = GUICreate("test",450, 300) $Tab1 = GUICtrlCreateTab(20, 24, 425, 201) $TabSheet1 = GUICtrlCreateTabItem("Tabsheet 1") $lbContagemGrupos2 = GUICtrlCreateLabel("aaaa", 50, 50) GUICtrlSetColor(-1, 0x0000FF) GUICtrlCreateTabItem("") $TabSheet2 = GUICtrlCreateTabItem(" ") $TabSheet3 = GUICtrlCreateTabItem(" ") GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func _TabRight() $CurPos = _GUICtrlTab_GetCurSel($Tab1) _GUICtrlTab_SetCurSel($Tab1, $CurPos + 1) $tab = "$TabSheet" & $CurPos GUICtrlSetState($TabSheet1 + $CurPos, $GUI_SHOW) Return EndFunc Func _TabLeft() $CurPos = _GUICtrlTab_GetCurSel($Tab1) _GUICtrlTab_SetCurSel($Tab1, $CurPos - 1) $tab = "$TabSheet" & $CurPos GUICtrlSetState($TabSheet1 + $CurPos, $GUI_SHOW) Return EndFunc Exit  
      can you help me?
    • By FroVN
      I made a software that download music and play it, but i have an idea , listen music online when we have internet connectionm ,no need for download any more, so i want to connect to soundclound but if wan to do that i need  to open google chrome , so is there any way to open that in hide and not show on taskbar? sorry for my bad english
    • By dubd83
      I am trying to click on a tab within an SWT_Window0. The problem is autoit can not see the tab's text and there is no controlid. I have tried using commands to obtain a handle and text with no luck. Any ideas on how to get control of this tab?
    • By Skeletor
      Hi Developers,
       
      While trying to find a way to actually style/skin the GUICtrlCreateTabItem, I read the help file and stated:
      My question to you guys is will this be updated? or am I hoping for something that will never come to pass?
      I've seen scripts between 2007 to 2009 allowing the tabs to be modified
      Reason for my question is I'm trying to make my GUI Tabs look more modern.
      Thanks in advance for reading my post.
       
×
×
  • Create New...