Asayami Posted February 17, 2020 Share Posted February 17, 2020 (edited) 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: expandcollapse popup;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 February 17, 2020 by Jos Link to comment Share on other sites More sharing options...
Developers Jos Posted February 17, 2020 Developers Share Posted February 17, 2020 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 Asayami 1 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 More sharing options...
Nine Posted February 17, 2020 Share Posted February 17, 2020 (edited) 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 February 17, 2020 by Nine Asayami 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Asayami Posted February 17, 2020 Author Share Posted February 17, 2020 Wow It's worked just use GUICtrlSetImage , ok thank you so much Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now