Jump to content

Background Image Problem - (Moved)


Asayami
 Share

Recommended Posts

Hey when i update the background image from switch case $Button 6, my buttons,  calendar don't appear, but i can press TAB to make them appear. So how to fix it ? Sorry for my bad English

Here's my script:

;GUICtrlSetState(-1, $GUI_DISABLE)
;GUICtrlSetData(-1, @YEAR & "/" & @MON & "/" & @MDAY)
;#include "_Msgbox.au3"
#include "_Msgbox.au3"
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <DateTimeConstants.au3>
#include <Sound.au3>
#Region ### START Koda GUI section ### Form=d:\autoit\helloworld project\form1_1.kxf
Global $Form1_1 = GUICreate("Desktop Program", 713, 446, -1, -1)
Global $Tab1 = GUICtrlCreateTab(8, 8, 689, 425)
Global $TabSheet1 = GUICtrlCreateTabItem("Hello !!!")
Global $Pic1 = GUICtrlCreatePic(@ScriptDir & '\Pictures\gg1.jpg', 10, 32, 684, 396)
GUICtrlSetState(-1, $GUI_DISABLE)
Global $Button1 = GUICtrlCreateButton("What time is it ???", 64, 80, 99, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xA6CAF0)
Global $Button2 = GUICtrlCreateButton("Play Default Music", 32, 120, 99, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xA6CAF0)
Global $MonthCal1 = GUICtrlCreateMonthCal("2020/02/09", 12, 215, 195, 148, BitOR($MCS_WEEKNUMBERS,$MCS_NOTODAY))
GUICtrlSetData(-1, @YEAR & "/" & @MON & "/" & @MDAY)
Global $Button3 = GUICtrlCreateButton("Choose", 140, 120, 58, 57)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xA6CAF0)
Global $Button4 = GUICtrlCreateButton("Play", 32, 152, 43, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xA6CAF0)
Global $Button5 = GUICtrlCreateButton("Stop", 88, 152, 43, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xA6CAF0)
Global $Button6 = GUICtrlCreateButton("Prev", 528, 392, 75, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xA6CAF0)
Global $Button7 = GUICtrlCreateButton("Next", 608, 392, 75, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xA6CAF0)
Global $TabSheet2 = GUICtrlCreateTabItem("Desktop")
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Global $defaultMusic = @ScriptDir & '\Music\Scarborough Fair.mp3'
Global $musicStatus = _SoundOpen($defaultMusic)
Global $time20 = TimerInit()
Global $count = 1
While 1
    If TimerDiff($time20) >= 1800000 Then
        _MsgBox(48, 'Alarm', 'Stand up and move around !!!', 1)
        $time20 = TimerInit()
    EndIf
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            _MsgBox(48, "It's is:", @HOUR & ':' & @MIN & ':' & @SEC)
        Case $Button2
            _SoundClose($musicStatus)
            $musicStatus = _SoundOpen($defaultMusic)
            _SoundPlay($musicStatus)
        Case $Button3
            $defaultMusic = FileOpenDialog('Open Music', @ScriptDir & '/Music', 'Audio File (*.mp3)', 3)
            _SoundClose($musicStatus)
            $musicStatus = _SoundOpen($defaultMusic)
        Case $Button4
            _SoundResume($musicStatus)
        Case $Button5
            _SoundPause($musicStatus)
        Case $Button6
            $count-=1
            If $count == 0 Then
                $count = 6
            EndIf
            $Pic1 = GUICtrlCreatePic(@ScriptDir & '\Pictures\gg' & $count & '.jpg', 10, 32, 684, 396)
            GUISetState(@SW_SHOWDEFAULT)

        Case $Button7
            GUICtrlDelete($Pic1)

    EndSwitch
WEnd


 

Edited by Jos
Link to comment
Share on other sites

  • Developers

Moved to the appropriate forum, as the Developer General Discussion forum very clearly states:

Quote

General development and scripting discussions. If it's super geeky and you don't know where to put it - it's probably here.


Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

Moderation Team

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Maybe something like this would work better :

Local $hidden = False

;while and switch code goes here

        Case $Button6
            $count -= 1
            If $count = 0 Then $count = 2
            GUICtrlSetImage($Pic1,$count = 2 ? 'P2.jpg' : 'P1.jpg')
            if $hidden Then
                GUICtrlSetState ($Pic1, $GUI_SHOW)
                $hidden = False
            endif
        Case $Button7
            GUICtrlSetState ($Pic1, $GUI_HIDE)
            $hidden = True

I made it work with 2 pictures.  Do not use == in If comparaison unless you want to compare case sensitive strings.

Edited by Nine
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...