botanic Posted September 27, 2007 Share Posted September 27, 2007 I am trying to get the GUI to display the image that is selects however once I change it once it from the original it wont change again :/ GUISetState () $pic = GUICtrlCreatePic("C:\BLPaletter.gif",0,0, 75,75 ) While 1 $msg = GUIGetMsg() If $msg = $fileitem Then $file = FileOpenDialog("Choose file...",@DesktopCommonDir,"Images (*.jpg;*.tga;*.jpeg)") If @error <> 1 Then GUICtrlCreateMenuitem ($file,$recentfilesmenu) $dir = FileGetLongName($file) if StringRight($dir, 3) = "tga" then $pic = GUICtrlSetImage ($pic, "C:\tga.jpg") GUISetState(@SW_SHOW,$pic) Else $pic = GUICtrlSetImage ($pic, $dir) GUISetState(@SW_SHOW,$pic) EndIf EndIf Link to comment Share on other sites More sharing options...
smashly Posted September 27, 2007 Share Posted September 27, 2007 Hi,I think you may be using the set state for your pic control..GUISetState(@SW_SHOW,$pic)Should be.. GUICtrlSetState($pic, $GUI_SHOW)But since you haven't posted the rest of the gui code then I can't really test it.Cheers Link to comment Share on other sites More sharing options...
botanic Posted September 27, 2007 Author Share Posted September 27, 2007 that didnt fix it :/ expandcollapse popup#include <GUIConstants.au3> FileInstall("C:\winchm\BLPaletter.exe", "C:\") FileInstall("C:\winchm\tga.jpg", "C:\tga.jpg") FileInstall("C:\winchm\BLPaletter.gif", "C:\BLPaletter.gif") FileInstall("C:\winchm\sample.chm", "C:\BLPaletterHELP.chm") sleep(10) Global $defaultstatus = "Ready" Global $status, $dir, $pic, $method = 0 GUICreate("BLPalleter BLPgui by botanic",300,160) $filemenu = GUICtrlCreateMenu ("&File") $fileitem = GUICtrlCreateMenuitem ("Open",$filemenu) GUICtrlSetState(-1,$GUI_DEFBUTTON) $batchitem = GUICtrlCreateMenuitem ("Open Batch",$filemenu) $recentbatchmenu = GUICtrlCreateMenu ("Recent Batch",$filemenu,1) $helpmenu = GUICtrlCreateMenu ("Help") $webpage = GUICtrlCreateMenuitem ("Help",$helpmenu) $infoitem = GUICtrlCreateMenuitem ("About BLPaletter",$helpmenu) $exititem = GUICtrlCreateMenuitem ("Exit",$filemenu) $recentfilesmenu = GUICtrlCreateMenu ("Recent Files",$filemenu,1) $separator1 = GUICtrlCreateMenuitem ("",$filemenu,2) ; create a separator line $viewmenu = GUICtrlCreateMenu("View",-1,1) ; is created before "?" menu $viewstatusitem = GUICtrlCreateMenuitem ("Statusbar",$viewmenu) GUICtrlSetState(-1,$GUI_CHECKED) $okbutton = GUICtrlCreateButton ("CONVERT",60,100,180,20) GUICtrlSetState(-1,$GUI_FOCUS) $Preview = GUICtrlCreateLabel ("Preview",15,76) $statuslabel = GUICtrlCreateLabel ($defaultstatus,0,122,300,16,BitOr($SS_SIMPLE,$SS_SUNKEN)) $preset = GUICtrlCreateCombo("-Standard", 78, 20, 100) $preset1 = GUICtrlSetData($preset, "-Icon") $preset2 = GUICtrlSetData($preset, "-Loadscreen") $preset3 = GUICtrlSetData($preset, "-Skin") $preset4 = GUICtrlSetData($preset, "-Custom") $Preview = GUICtrlCreateLabel ("Preset Modes",78,3, "","","",$WS_EX_TRANSPARENT) $p = GUICtrlCreateCombo("-Paletted", 183, 20, 100) $j = GUICtrlSetData($p, "-JPG") $Preview1 = GUICtrlCreateLabel ("Compression Mode",183,3, "","","",$WS_EX_TRANSPARENT) $Preview2 = GUICtrlCreateLabel ("# of Mipmaps",183,50, "","","",$WS_EX_TRANSPARENT) $mip = GUICtrlCreateInput ("10",198,70, 50, 20) $mip = GUICtrlCreateUpdown($mip) GUICtrlSetLimit($mip,10,1) $pic = GUICtrlCreatePic("C:\BLPaletter.gif",0,0, 75,75 ) $Preview12 = GUICtrlCreateLabel ("Quality",115,50, "",19,"",$WS_EX_TRANSPARENT) $quality = GUICtrlCreateInput ("256",104,70, 60, 20) $quality = GUICtrlCreateUpdown($quality) GUICtrlSetLimit($quality,256,1) GUISetState () While 1 $msg = GUIGetMsg() If $msg = $fileitem Then $file = FileOpenDialog("Choose file...",@DesktopCommonDir,"Images (*.jpg;*.tga;*.jpeg;*.bmp)") If @error <> 1 Then GUICtrlCreateMenuitem ($file,$recentfilesmenu) $dir = FileGetLongName($file) if StringRight($dir, 3) = "tga" then $pic = GUICtrlSetImage ($pic, "C:\tga.jpg") GUICtrlSetState($pic, $GUI_SHOW) Else $pic = GUICtrlSetImage ($pic, $dir) GUICtrlSetState($pic, $GUI_SHOW) EndIf $method = 1 EndIf If $msg = $batchitem Then $file = FileSelectFolder("Choose file...","c:/","All (*.*)") If @error <> 1 Then GUICtrlCreateMenuitem ($file,$recentbatchmenu) $dir = FileGetLongName($file) GUICtrlCreatePic($dir,0,0, 75,75 ) GUICtrlSetState($pic, $GUI_SHOW) $method = 2 EndIf If $msg = $viewstatusitem Then If BitAnd(GUICtrlRead($viewstatusitem),$GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($viewstatusitem,$GUI_UNCHECKED) GUICtrlSetState($statuslabel,$GUI_HIDE) Else GUICtrlSetState($viewstatusitem,$GUI_CHECKED) GUICtrlSetState($statuslabel,$GUI_SHOW) EndIf EndIf If $msg = $GUI_EVENT_CLOSE Or $msg = $exititem Then ExitLoop If $msg = $infoitem Then $sScrollText = 'BLPaletter By:' & @CRLF & _ 'PitzerMike' & @CRLF & _ ' ' & @CRLF & _ 'BLPgui Created By:' & @CRLF & _ 'Botanic' & @CRLF & _ ' ' & @CRLF & _ 'Special Thanks To' & @CRLF & _ 'www.wc3campaigns.net' & @CRLF & _ ' ' & @CRLF $sMain = GUICreate("BLPaletter AND BLPgui", 270 ,150,-1,-1) GUISetBkColor(0x000000) GUISetFont(12,400,0,"Verdana") $sLabel = GUICtrlCreateLabel($sScrollText,10,150/3,250,10000,$ES_CENTER) GUICtrlSetColor ( $sLabel, 0x00ff18) $sTransHeight = 3 For $x = 0 to 15 $stemp = GUICreate("",270, $sTransHeight, 0, $sTransHeight * $x ,BitOR($WS_POPUP,$WS_CHILD),$WS_EX_MDICHILD,$sMain) GUISetBkColor(0x000000) GUISetState() WinSetTrans($stemp,"",(255/15)*(-1*($x-15))) Next For $x = 0 to 15 $stemp = GUICreate("",270, $sTransHeight, 0, 147 - ($sTransHeight * $x) ,BitOR($WS_POPUP,$WS_CHILD),$WS_EX_MDICHILD,$sMain) GUISetBkColor(0x000000) GUISetState() WinSetTrans($stemp,"",(255/15)*(-1*($x-15))) Next GUISetState(@SW_SHOW,$sMain) $sTime = TimerInit() $sScroll = -105 $sFirstTime = 1 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete () ExitLoop EndSwitch If TimerDiff($sTime) > 30 Then $sFirstTime = 0 $sTime = TimerInit() ControlMove($sMain,"",$sLabel,10,(150/3)-$sScroll) $sScroll += 1 if (150/3)-$sScroll = -150 then $sScroll = -105 EndIf WEnd EndIf If $msg = $webpage then ShellExecute("BLPaletterhelp.chm", @ScriptDir) WEnd FileDelete("C:\BLPaletter.exe") FileDelete("C:\BLPaletterHELP.chm") GUIDelete() Exit Run(@ComSpec & " /c " & 'BLPaletter', "", @SW_HIDE) ;FileSelectFolder("Please Select the input Batch folder", "") ;FileSelectFolder("Please Select the Output folder", "") ;FileOpenDialog("Please select the location of the BLPalleter program", "","All (BLPaletter.exe)") Link to comment Share on other sites More sharing options...
smashly Posted September 27, 2007 Share Posted September 27, 2007 To set an image you first need a picture control or an icon control or a button control(with a button use either style of $BS_ICON or $BS_BITMAP)Once you have a control then you can use GUICtrlSetImage () to set the image on the control.As it is your trying to set an image to itself..$pic = GUICtrlSetImage ($pic, "C:\tga.jpg") Maybe you could try creating a pic control first..$pic = GUICtrlCreatePic("", 40, 40, 60, 60)GUICtrlSetImage ($pic , "C:\tga.jpg") Cheers Link to comment Share on other sites More sharing options...
botanic Posted September 27, 2007 Author Share Posted September 27, 2007 $pic = GUICtrlCreatePic("C:\BLPaletter.gif",0,0, 75,75 ) i did that already :/ Link to comment Share on other sites More sharing options...
smashly Posted September 27, 2007 Share Posted September 27, 2007 But after you have created the $pic variable you have changed it by calling $pic = GUICtrlSetImage ($pic, "C:\tga.jpg") So now the variable $pic wouldn't be the same control ID of your original declaration of the $pic variable.Cheers Link to comment Share on other sites More sharing options...
botanic Posted September 27, 2007 Author Share Posted September 27, 2007 Thanks it works now... im not a GUI person can you tell 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