Jump to content

how to use picturebox to host controls


Recommended Posts

I'd like to use the picturebox control to host some other controls, but its not working in koda. the controls seems to go behind the picturebox.

I decided to use the picturebox because the frame control does not properly suite my application.

Does anyone know how to do this?

Link to comment
Share on other sites

  • Moderators

TheCurrent,

I wish I had £1 for every time this has been asked since I have been here! :>

From the very useful and sorely under-read Help file (look at the Remarks on the GUICtrlCreatePic page): :unsure:

"If a picture is set as a background picture, as the other controls will overlap, it's important to disable the pic control and create it after the others controls"

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 for your answer,i read the documentation, but because my gui is albeit complex, i am using Koda and included the $WS_CLIPSIBLINGS to make the hosted controls from going behind, but it still does not move them together when the picturebox is moved

the man reason am using a picturebox is that i have stacked 10 picture boxes ontop of each other, and need each to hold its control.

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

is there any other control that can do this?

Link to comment
Share on other sites

TheCurrent,

I wish I had £1 for every time this has been asked since I have been here! :>

From the very useful and sorely under-read Help file (look at the Remarks on the GUICtrlCreatePic page): :unsure:

"If a picture is set as a background picture, as the other controls will overlap, it's important to disable the pic control and create it after the others controls"

M23

LoL, this just solved a little problem I've been having for a while now.

Link to comment
Share on other sites

  • Moderators

TheCurrent,

It is always a good idea to explain the problem completely when you post a question - then you do not get unhelpful replies and the responder does not waste their (perhaps valuable) time. :>

Stacking Pic controls is fraught with diffculty as you have discovered. Why not post your code (at least the GUI part) so that we can take a look. And please explain carefully what is not happening as you wish it to because I am very confused by the content of your last post. :unsure:

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 for your answer,i read the documentation, but because my gui is albeit complex, i am using Koda and included the $WS_CLIPSIBLINGS to make the hosted controls from going behind, but it still does not move them together when the picturebox is moved

the man reason am using a picturebox is that i have stacked 10 picture boxes ontop of each other, and need each to hold its control.

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

is there any other control that can do this?

Lol, why dont you just set the controls state to "$GUI_HIDE" instead of doing what you said?

Edit: is there a way to reduce flickering?

Like when a user clicks on a button, is there a way to make the gui look like its not having a seizure?

Link to comment
Share on other sites

  • Moderators

System238,

is there a way to reduce flickering?

This is usually caused by updating the control each pass through the idle loop. The trick is to only change the control when it is needed by checking to see what state it is in - like this: ;)

#include <GUIConstantsEx.au3>

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

$hLabel_1 = GUICtrlCreateLabel("I will flicker", 10, 10, 200, 20)

$hLabel_2 = GUICtrlCreateLabel("I will not flicker", 10, 40, 200, 20)

$hButton = GUICtrlCreateButton("Update", 10, 100, 80, 30)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton
            GUICtrlSetData($hLabel_2, "Change so the loop will update the text")
    EndSwitch

    GUICtrlSetData($hLabel_1, "I will flicker")
    If GUICtrlRead($hLabel_2) <> "I will not flicker" Then
        GUICtrlSetData($hLabel_2, "I will not flicker")
    EndIf

WEnd

TheCurrent,

Why start a new thread? :unsure: But I will go and take a look. :>

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

MB, sorry for that, i thought i get better response over there, and i misunderstood you

Why not post your code (at least the GUI part) so that we can take a look.

Here is a basic setup

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=
$Form2 = GUICreate("Form1", 511, 339, 225, 150)
$Pic1 = GUICtrlCreatePic("", 195, 55, 271, 201, BitOR($GUI_SS_DEFAULT_PIC,$WS_CLIPSIBLINGS))
GUICtrlSetOnEvent(-1, "Pic1Click")
$Pic2 = GUICtrlCreatePic("", 10, 50, 251, 191, BitOR($GUI_SS_DEFAULT_PIC,$WS_CLIPSIBLINGS))
GUICtrlSetOnEvent(-1, "Pic2Click")
$Input1 = GUICtrlCreateInput("Input1", 95, 70, 121, 21)
GUICtrlSetOnEvent(-1, "Input1Change")
$Input2 = GUICtrlCreateInput("Input2", 325, 120, 126, 21)
GUICtrlSetOnEvent(-1, "Input2Change")
$Button1 = GUICtrlCreateButton("Button1", 170, 210, 81, 21)
GUICtrlSetOnEvent(-1, "Button1Click")
$Button2 = GUICtrlCreateButton("Button2", 380, 220, 76, 21)
GUICtrlSetOnEvent(-1, "Button2Click")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    Sleep(100)
WEnd
Link to comment
Share on other sites

MB, sorry for that, i thought i get better response over there, and i misunderstood you

Why not post your code (at least the GUI part) so that we can take a look.

Here is a basic setup

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=
$Form2 = GUICreate("Form1", 511, 339, 225, 150)
$Pic1 = GUICtrlCreatePic("", 195, 55, 271, 201, BitOR($GUI_SS_DEFAULT_PIC,$WS_CLIPSIBLINGS))
GUICtrlSetOnEvent(-1, "Pic1Click")
$Pic2 = GUICtrlCreatePic("", 10, 50, 251, 191, BitOR($GUI_SS_DEFAULT_PIC,$WS_CLIPSIBLINGS))
GUICtrlSetOnEvent(-1, "Pic2Click")
$Input1 = GUICtrlCreateInput("Input1", 95, 70, 121, 21)
GUICtrlSetOnEvent(-1, "Input1Change")
$Input2 = GUICtrlCreateInput("Input2", 325, 120, 126, 21)
GUICtrlSetOnEvent(-1, "Input2Change")
$Button1 = GUICtrlCreateButton("Button1", 170, 210, 81, 21)
GUICtrlSetOnEvent(-1, "Button1Click")
$Button2 = GUICtrlCreateButton("Button2", 380, 220, 76, 21)
GUICtrlSetOnEvent(-1, "Button2Click")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    Sleep(100)
WEnd

remember that am using koda

Link to comment
Share on other sites

  • Moderators

TheCurrent,

Go and look in the other thread. :unsure:

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