Sign in to follow this  
Followers 0
tonycst

How to reference objects from another tab ?

4 posts in this topic

I have a listview and some other items i want to use for next tab. How do i go about doing it in a way that both tabs will have it working exactly same way and effecting both tabs as well (or more tabs) ?

Thanks  in advance.

Share this post


Link to post
Share on other sites



tonycst,

Having the same controls on several tabs seems a strange way to go about things as the idea of tabs is to show separate controls. If you want the controls to be identical than you will need to create 2 sets and action both together whenever they change. But why not place the ListView et al outside the tab so that they are visible regardless of the tab selected? Or you might think about creating them outside the tab creation structure and then managing their visibility depending on the tab selected - see the Tabs tutorial in the Wiki to see what I mean. ;)

If you could give us a few more details on exactly what the GUI and tabs are supposed to contain we might be able to offer some better advice on how best to achieve your goal. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

#3 ·  Posted (edited)

But why not place the ListView et al outside the tab so that they are visible regardless of the tab selected?

I knew about this ! I had it done few times in the past but thought it was a bug.

Question.

List view loads available drives. Once drive is clicked, it updates other controls with drive information.

Update is only working when in main tab, but other 2 tabs seem to have no effect when i click the drive from listview, as if listview is ignored for all other tabs.

Listview and all its controls are created before any tabs as you suggested.

I can see them in all tabs, but they work only for 1st tab.

Edited by tonycst

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

tonycst,

This updates from any tab...maybe you have to create all tabs before LV population...note the "case 0" to prevent running the LV code if nothing is selected...

#include <GUIConstantsEx.au3>
#include <array.au3>
#include <GuiListView.au3>

#AutoIt3Wrapper_Add_Constants=n

local $gui010   =   guicreate('')
local $aSize    =   wingetclientsize($gui010)
local $tab      =   guictrlcreatetab(20,20,$aSize[0]-40,$aSize[1]-40)
local $tb010    =   guictrlcreatetabitem('ONE')
                    guictrlcreatetabitem('')
local $tb020    =   guictrlcreatetabitem('TWO')
                    guictrlcreatetabitem('')
local $tb030    =   guictrlcreatetabitem('THREE')
                    guictrlcreatetabitem('')

; this listview will appear on every tab
local $lst010   =   guictrlcreatelistview('Select To Change - Select Again to Change Back',30,$aSize[1]-150,$aSize[0]-60,110)
                    for $1 = 1 to 5
                        guictrlcreatelistviewitem('Item' & stringformat('%03i',$1),$lst010)
                    next
                    _GUICtrlListView_SetColumnWidth($lst010,0,$LVSCW_AUTOSIZE_USEHEADER)
                    guisetstate()

while 1
    switch guigetmsg()
        case 0              ; this prevents running the LV case if nothing is selected
            continueloop
        case $gui_event_close
            Exit
        case guictrlread($lst010)
            guictrlsetdata(guictrlread($lst010),guictrlread(guictrlread($lst010)) = 'Changed Item|' ? 'Item' & stringformat('%03i',guictrlread($lst010)-7) : 'Changed Item')
    EndSwitch
WEnd

@M23 - Thanks, I didn't know this worked!

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

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  
Followers 0