Jump to content

How to avoid visible tab switching?


htrd
 Share

Recommended Posts

Hi,

I have a tab control in my GUI, which I want to create controls in - after creation of the GUI and the tab control.

My problem is: To create or edit controls in the desired tab I have to switch to the tab with GUISwitch(...). Now when AutoIT switches to the tab, this is visible in the GUI.

I want to be able to edit contols in the tab in the "background" so that the user doesn't see that this happens.

I know that I can manually switch back to another tab by using GUISetState(), but I don't want the switching to be noticed at all, can anyone tell me how this is manageable?

 

Thanks in advance

 

PS: I know that I could set the GUI state to @SW_SHOW after all has been done, but that would be just a workaround.

Edited by htrd
Link to comment
Share on other sites

  • Moderators

htrd,

Welcome to the AutoIt forums.

I have to switch to the tab with GUISwitch(...). Now when AutoIT switches to the tab, this is visible in the GUI

Not when I try:

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("Test", 500, 500)

$cTab = GUICtrlCreateTab(10, 10, 480, 200)

$cTab_0 = GUICtrlCreateTabItem("Tab 0")
GUICtrlCreateLabel("Tab 0 label", 50, 50, 200, 20)
GUICtrlSetBkColor(-1, 0xFFCCCCC)
$cTab_1 = GUICtrlCreateTabItem("Tab 1")
GUICtrlCreateTabItem("")

$cAction = GUICtrlCreateButton("Action", 10, 450, 80, 30)

GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cAction

            GUISwitch($hGUI, $cTab_1)
            GUICtrlCreateLabel("Tab 1 Label", 50, 50, 200, 20)
            GUICtrlSetBkColor(-1, 0xCCFFCC)
            GUISwitch($hGUI)
    EndSwitch

WEnd

To me that looks like:

I want to be able to edit contols in the tab in the "background" so that the user doesn't see that this happens

Perhaps if you posted the code you have been trying (see here how to do it) we might be able to see what you have done differently.

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

 

Link to comment
Share on other sites

Hey Melba, thanks for your reply!

The difference is that after creating the controls in the specific tab, I end the creation with GUICtrlCreateTabItem("").

The AutoIT help says:

To create a new control on an existing tabitem use GUISwitch($hWin,$tabitem) to select it and just create your new control. Don't forget to close your tabitem creation with GUICtrlCreateTabItem("").

I understand that I have to to use GUICtrlCreateTabItem("") after every change of the tab controls. If I omit it it works! But I don't know if that's the right way and won't cause other errors/behaviors.

 

Also when using your code, when you first click on tab 1 and then you click on the Action Button, you don't see the change until you switch the tab and switch back to tab 1.

Edited by htrd
Link to comment
Share on other sites

  • Moderators

htrd,

Always obey the Help file! Try this instead:

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cAction

            ; Get selected tab
            $cTabSel = GUICtrlRead($cTab, 1)
            GUISwitch($hGUI, $cTab_1)
            GUICtrlCreateLabel("Tab 1 Label", 50, 50, 200, 20)
            GUICtrlSetBkColor(-1, 0xCCFFCC)
            GUICtrlCreateTabItem("")
            ; Reselect selected tab
            GUICtrlSetState($cTabSel, $GUI_SHOW)
    EndSwitch
WEnd

That does what you want when I test it.

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

 

Link to comment
Share on other sites

  • Moderators

hrd,

It works because you are repainting the tab control by reselecting a tab to show once the changes have been made. This way the changes will be implemented regardless of which tab is selected when they are made and it all happens so quickly the user does not notice.

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

 

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...