Sign in to follow this  
Followers 0
incepator

Multi GUICtrlCreatePic

8 posts in this topic

I have a problem with GUICtrlCreatePic.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 533, 365, 445, 403)
$Button1 = GUICtrlCreateButton("adauga", 8, 8, 75, 25)
$Pic1 = GUICtrlCreatePic("G:\Poze\50 Amazing Mix HQ Wallpapers [Set 1]\Mix-Pack-8 (3).jpg", 0, 0, 532, 364, -1, $GUI_WS_EX_PARENTDRAG)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$Pic2 = GUICtrlCreatePic("G:\Poze\50 Amazing Mix HQ Wallpapers [Set 1]\Mix-Pack-8.jpg", 200, 96, 244, 188)
EndSwitch
WEnd

$Button1 is not visible...

if press $Button1, not create $Pic2 ...

Share this post


Link to post
Share on other sites



incepator,

This is all down to how AutoIt deals with the ordering the Pic controls. I have always found it advisable to create all the Pic controls initially and then hide/show them as required. ;)

You also need to realise that unless you disable the background Pic control, your button will not work even if it is visible. Basically if both the Pic control and the overlapping button are active then AutoIt does not know which you want to action - and so it actions neither. However, this means that your $GUI_WS_EX_PARENTDRAG style does not work, so we have to get around that as well! :wacko:

All in all this script should do what you want:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <SendMessage.au3>

Global Const $SC_DRAGMOVE = 0xF012

$Form1 = GUICreate("Form1", 533, 365, 445, 403)
$Pic1 = GUICtrlCreatePic("Image_Path_1", 0, 0, 532, 364) ;, -1, $GUI_WS_EX_PARENTDRAG) ; No point in using this style
GUICtrlSetState(-1, $GUI_DISABLE)
$Pic2 = GUICtrlCreatePic("Image_Path_2", 200, 96, 244, 188)
GUICtrlSetState(-1, $GUI_HIDE)
$Button1 = GUICtrlCreateButton("adauga", 8, 8, 75, 25)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GUI_EVENT_PRIMARYDOWN
             _SendMessage($Form1, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0)
        Case $Button1
            GUICtrlSetState($Pic2, $GUI_SHOW)
    EndSwitch
WEnd

The Moving and Resizing PopUp GUIs tutorial in the Wiki explains how the code moves the GUI - and offers some other ways to do it as well. ;)

All clear? :)

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)

thank you for reply!

I learned something new from you, but the problem is slightly more delicate.

to explain:

When you press the button pee see will create a list of "GUICtrlCreatePic" depending on how many photos are in a folder, so I do not know how many pictures must put exct to create the first GUICtrlCreatePic.

thanks

Edited by incepator

Share this post


Link to post
Share on other sites

incepator,

Then I think using a child GUI to display them would be a sensible solution. And if you run out of space you may find my Scrollbars UDF helpful to fit them all in. ;)

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

incepator,

And how does that help? :huh:

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

I found some alternative ... it actually, though not perfect, can achieve a result ... thanks.

Share this post


Link to post
Share on other sites

incepator,

So why not post the code so that others can learn from it as well. ;)

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

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