Jump to content

stacking picturebox control, and its hosted control


Recommended Posts

am trying to stack pictureboxs each contaning its own set of some other controls, but its not working in koda. the controls seems to go behind the picturebox, so i used the $WS_CLIPSIBLINGS style

the man reason am using a pictureboxs is that i have stacked 10 pictureboxes ontop of each other, and need each to hold its controls, i would hide all unnecessary picturebox at runtime and display only the one needed. the effect is that hiding a picturebox, automatically hide its controls.

i would have used a tab control, but it would take some extra space and defeat the purpose of hiding the other controls i the picturebox, showing them only when necessary, not switching.

Does anyone know how to do this?

is there any other control that can do this?

can the picturebox host controls?

Link to comment
Share on other sites

  • Moderators

TheCurrent,

I am still confused by what you are trying to do. :unsure:

Let me see if I have it straight: You want to have 10 different "screens" on your GUI. At present you are trying to use 10 Pic controls to hold the controls in each "screen" and hiding/showing the Pic controls to make only the current "screen" visible. Is that close? :>

If so, why are using Pic controls? Why not just hide/show the other controls directly? I would do it like this: :D

#include <GUIConstantsEx.au3>

; Create arrays to hold the controls for each screen
Global $aScreen_1[2]
Global $aScreen_2[2]

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

; Screen 1
$hLabel_1 = GUICtrlCreateLabel("Label 1", 10, 10, 200, 20)
$aScreen_1[0] = $hLabel_1
$hButton_1 = GUICtrlCreateButton("Button 1", 100, 100, 80, 30)
$aScreen_1[1] = $hButton_1

; Screen 2
$hLabel_2 = GUICtrlCreateLabel("Label 2", 10, 40, 200, 20)
$aScreen_2[0] = $hLabel_2
$hButton_2 = GUICtrlCreateButton("Button 2", 100, 140, 80, 30)
$aScreen_2[1] = $hButton_2

_Swap_Screen(1)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton_1
            _Swap_Screen(1)
        Case $hButton_2
            _Swap_Screen(2)

    EndSwitch

WEnd

Func _Swap_Screen($iIndex)

    Switch $iIndex
        Case 1
            ; Hide Screen 1
            For $i = 0 To 1
                GUICtrlSetState($aScreen_1[$i], $GUI_HIDE)
            Next
            ; Show Screen 2
            For $i = 0 To 1
                GUICtrlSetState($aScreen_2[$i], $GUI_SHOW)
            Next
        Case 2
            ; Hide Screen 2
            For $i = 0 To 1
                GUICtrlSetState($aScreen_2[$i], $GUI_HIDE)
            Next
            ; Show Screen 1
            For $i = 0 To 1
                GUICtrlSetState($aScreen_1[$i], $GUI_SHOW)
            Next
    EndSwitch
EndFunc

The _Swap_Screen function is pretty rough, but it gives you the idea. ;)

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

thanks, but this implementation would be a very long coding for me.

i use spy++ to check the styles of a regulat picturebox, it has WS_CLIPCHILDREN style along with the WS_CLIPSIBLINGS, and i found this in the documentation

Adding $WS_CLIPCHILDREN style can avoid some flickering when resizing GUI containing Edit control for example.

Koda does not list this style as style that can be added to picturebox control

Link to comment
Share on other sites

thanks, but this implementation would be a very long coding for me.

i use spy++ to check the styles of a regulat picturebox, it has WS_CLIPCHILDREN style along with the WS_CLIPSIBLINGS, and i found this in the documentation

Koda does not list this style as style that can be added to picturebox control

Well, Koda doesnt exactly do everything fore you...

You need to manually adjust those settings as koda only helps you create a basic skeleton of what you need done.

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