Jump to content
Sign in to follow this  
AppTux

More than three images in a GUI

Recommended Posts

AppTux

I want more than three pictures in a GUI.

When I try this, i only can see three pictures.

I have a GUI that contains a minimize and close button and a button.

The close and minimize button 're pictures.

the bar also.

when i click the close button, you have to see an other picture.

But not.

I only see a white picture, not I want to see.

plz help me!!

#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
#include <GuiMenu.au3>
#include <File.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $theme[6],$GUI1,$inp,$min,$close,$msg,$cursor
    
    _FileReadToArray("Resources\Theme.ini",$theme)
    $GUI1 = GUICreate("Example", 450,300,-1,-1,$WS_POPUP)
    GUISetBkColor(0xd8d8d8)
    GUICtrlCreatePic($theme[2],0,0,450,300)
    GUICtrlSetState(-1,$GUI_DISABLE)
    $min = GUICtrlCreatePic($theme[3],375,0,25,18)
    $close = GUICtrlCreatePic($theme[5],400,0,50,18)
    $inp = GUICtrlCreateButton("Click on Me!",20,100,200,20)
    GUISetState()

    Do
        $msg = GUIGetMsg()
        $cursor = GUIGetCursorInfo($GUI1)
        If $msg = $close Then
            GUICtrlDelete($close)
            GUICtrlCreatePic($theme[6],255,0,20,20)
            Sleep(100)
            
            Exit
        EndIf
    Until $msg = $GUI_EVENT_CLOSE
EndFunc

PowerSlide2UnlockiPhone look-a-like program you can use to lock your pc, you can't access your desktop again until the password is entered and the slider slided to the right. (really proud of it)-- After a time AutoIt and Windows, I switched to Mac. Don't expect me to answer anymore.

Share this post


Link to post
Share on other sites
water

Just a quick shot in the dark. What if you add a "GUISetState()" before the Sleep Command and change the sleep to "sleep(2000)" (two seconds) so the picture gets the time to be display. sleep(100) is only a 1/10th of a second.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Melba23

AppTux,

First, welcome to the Autoit forums. :)

Your new picture is being created, but is hidden behind the large GUI-sized one - I have had similar problems when adding pic controls after having created the GUI so it was an easy spot. I found that you need to create the picture earlier and hide it - and then show it again when you are ready. This script works for me using graphics from my machine:

#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
#include <GuiMenu.au3>
#include <File.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $GUI1,$inp,$min,$close,$msg,$cursor, $next

    _FileReadToArray("Resources\Theme.ini",$theme)
    $GUI1 = GUICreate("Example", 450,300,-1,-1,$WS_POPUP)
    GUISetBkColor(0xd8d8d8)
    GUICtrlCreatePic($theme[2],0,0,450,300)
    GUICtrlSetState(-1,$GUI_DISABLE)
    $min = GUICtrlCreatePic($theme[3],375,0,25,18)
    $close = GUICtrlCreatePic($theme[5],400,0,50,18)
    $next = GUICtrlCreatePic($theme[6],255,0,40,40)
    GUICtrlSetState(-1, $GUI_HIDE)

    $inp = GUICtrlCreateButton("Click on Me!",20,100,200,20)
    GUISetState()

    Do
        $msg = GUIGetMsg()
        $cursor = GUIGetCursorInfo($GUI1)
        If $msg = $close Then
            GUICtrlDelete($close)
            GUICtrlSetState($next, $GUI_SHOW)
            Sleep(2000)

            Exit
        EndIf
    Until $msg = $GUI_EVENT_CLOSE
EndFunc

I increased the Sleep a bit so you can actually see the new graphic before the whole GUI disappears! ;)

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
AppTux

AppTux,

First, welcome to the Autoit forums. :)

Your new picture is being created, but is hidden behind the large GUI-sized one - I have had similar problems when adding pic controls after having created the GUI so it was an easy spot. I found that you need to create the picture earlier and hide it - and then show it again when you are ready. This script works for me using graphics from my machine:

#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
#include <GuiMenu.au3>
#include <File.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $GUI1,$inp,$min,$close,$msg,$cursor, $next

    _FileReadToArray("Resources\Theme.ini",$theme)
    $GUI1 = GUICreate("Example", 450,300,-1,-1,$WS_POPUP)
    GUISetBkColor(0xd8d8d8)
    GUICtrlCreatePic($theme[2],0,0,450,300)
    GUICtrlSetState(-1,$GUI_DISABLE)
    $min = GUICtrlCreatePic($theme[3],375,0,25,18)
    $close = GUICtrlCreatePic($theme[5],400,0,50,18)
    $next = GUICtrlCreatePic($theme[6],255,0,40,40)
    GUICtrlSetState(-1, $GUI_HIDE)

    $inp = GUICtrlCreateButton("Click on Me!",20,100,200,20)
    GUISetState()

    Do
        $msg = GUIGetMsg()
        $cursor = GUIGetCursorInfo($GUI1)
        If $msg = $close Then
            GUICtrlDelete($close)
            GUICtrlSetState($next, $GUI_SHOW)
            Sleep(2000)

            Exit
        EndIf
    Until $msg = $GUI_EVENT_CLOSE
EndFunc

I increased the Sleep a bit so you can actually see the new graphic before the whole GUI disappears! B)

M23

Thanks, it works very well.

also thanks for the welcome ;)

this is very useful, also for the minimize button and other things in my GUI

AppTux


PowerSlide2UnlockiPhone look-a-like program you can use to lock your pc, you can't access your desktop again until the password is entered and the slider slided to the right. (really proud of it)-- After a time AutoIt and Windows, I switched to Mac. Don't expect me to answer anymore.

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  

×