|
You last visited: Today at 16:06
Advertisement
[Switch]Images
Discussion on [Switch]Images within the AutoIt forum part of the Coders Den category.
02/13/2014, 18:54
|
#1
|
elite*gold: 0
Join Date: Jan 2013
Posts: 2,450
Received Thanks: 1,880
|
[Switch]Images
Hello,
so I've created a new project, I want to know how to when I click on a picture it switch to another picture?
I mean : I made a picture for the check box which is unchecked, I want to make a function that when I press on the picture it make it checked.
|
|
|
02/13/2014, 19:16
|
#2
|
elite*gold: 60
Join Date: Aug 2009
Posts: 2,256
Received Thanks: 815
|
Just replace the GUICtrlCreateButton with GUICtrlCreatePic
Code:
$h = GUICreate("", 100, 100)
$b1 = GUICtrlCreateButton("checked", 0, 0)
$b2 = GUICtrlCreateButton("unchecked", 0, 25)
$c = GUICtrlCreateCheckbox("sample", 0, 50)
GUISetState()
While 1
Switch GUIGetMsg()
Case -3
Exit
Case $b1
GUICtrlSetState($c, 1)
Case $b2
GUICtrlSetState($c, 4)
EndSwitch
WEnd
|
|
|
02/14/2014, 08:34
|
#3
|
elite*gold: 0
Join Date: Jan 2013
Posts: 2,450
Received Thanks: 1,880
|
Quote:
Originally Posted by alpines
Just replace the GUICtrlCreateButton with GUICtrlCreatePic
Code:
$h = GUICreate("", 100, 100)
$b1 = GUICtrlCreateButton("checked", 0, 0)
$b2 = GUICtrlCreateButton("unchecked", 0, 25)
$c = GUICtrlCreateCheckbox("sample", 0, 50)
GUISetState()
While 1
Switch GUIGetMsg()
Case -3
Exit
Case $b1
GUICtrlSetState($c, 1)
Case $b2
GUICtrlSetState($c, 4)
EndSwitch
WEnd
|
But the 2 pictures are in the same position, will this work with it?
Testing...
More explanation : I've made a squared small picture, added beside it a label called for E.X : Hit Range, I want when I press on the picture, it automatically changes to another picture which in the same position.
If you do not understand I can add pictures.
|
|
|
02/14/2014, 12:59
|
#4
|
elite*gold: 0
Join Date: Nov 2011
Posts: 1,448
Received Thanks: 1,257
|
Quote:
Originally Posted by "V"
But the 2 pictures are in the same position, will this work with it?
Testing...
More explanation : I've made a squared small picture, added beside it a label called for E.X : Hit Range, I want when I press on the picture, it automatically changes to another picture which in the same position.
If you do not understand I can add pictures.
|
PHP Code:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 397, 141, 308, 262)
$Pic1 = GUICtrlCreatePic("filepathpicture1", 32, 24, 233, 105)
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 280, 56, 97, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Pic1
If GUICtrlRead($Checkbox1) == $GUI_CHECKED Then
GUICtrlSetImage($Pic1, "filepathpicture1")
GuiCtrlSetState($Checkbox1, $GUI_UNCHECKED)
Else
GUICtrlSetImage($Pic1, @ScriptDir & "filepathpictur2")
GuiCtrlSetState($Checkbox1, $GUI_CHECKED)
EndIf
EndSwitch
WEnd
Something like that?
|
|
|
02/15/2014, 12:02
|
#5
|
elite*gold: 0
Join Date: Jan 2013
Posts: 2,450
Received Thanks: 1,880
|
Quote:
Originally Posted by Kilroy.
PHP Code:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 397, 141, 308, 262)
$Pic1 = GUICtrlCreatePic("filepathpicture1", 32, 24, 233, 105)
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 280, 56, 97, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Pic1
If GUICtrlRead($Checkbox1) == $GUI_CHECKED Then
GUICtrlSetImage($Pic1, "filepathpicture1")
GuiCtrlSetState($Checkbox1, $GUI_UNCHECKED)
Else
GUICtrlSetImage($Pic1, @ScriptDir & "filepathpictur2")
GuiCtrlSetState($Checkbox1, $GUI_CHECKED)
EndIf
EndSwitch
WEnd
Something like that?
|
<.<, see :
I want when I press on the Red Squared pic down :
Turns into this :
So it looks like a checkbox but in real it is Pic and switched to other pic
|
|
|
02/15/2014, 14:34
|
#6
|
elite*gold: 0
Join Date: Nov 2011
Posts: 1,448
Received Thanks: 1,257
|
Quote:
Originally Posted by "V"
<.<, see :
I want when I press on the Red Squared pic down :
|
Than do this:
PHP Code:
#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 397, 141, 308, 262) $Pic1 = GUICtrlCreatePic(@ScriptDir & '\img_black.jpg', 32, 24, 233, 105) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ###
Dim $Pic_check = 0 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Pic1 If $Pic_check = 1 Then GUICtrlSetImage($Pic1, @ScriptDir & '\img_black.jpg') $Pic_check = 0 Else GUICtrlSetImage($Pic1, @ScriptDir & '\img_white.jpg') $Pic_check = 1 EndIf
EndSwitch WEnd
You only have to change, the koords and pathes.
If you need help, send me your code via pn
|
|
|
 |
Similar Threads
|
Metin2 png images pack 300+ images
11/15/2014 - Metin2 PServer Guides & Strategies - 9 Replies
Hi, here is 300 piece png images pack, it is mobs, npc, character weapons, house and more images :)
Link to download: https://www.rapidshare.com/#!download|306|19862143 22|CirilGyujtemeny.rar|63099
Please take thanks for upload.
Password for extract: ciril
|
[Selling] 24 Port Switch - 3Com Switch 3300 24 Port
05/13/2013 - Trading - 4 Replies
Hallo zusammen,
hier biete ich einen Switch der Firma 3 Com an.
Model 3C16406 24 Port / SuperStack II
Technisch Daten sind hier zu umfangreich Bitte aus dem Netz laden .
|
I need to Switch Item Images.
10/17/2008 - Conquer Online 2 - 0 Replies
I have seen the previous article about stanchers into dbs as a scam. Not interested in scamming anyone.. Tried to locate the files but believe that since that post files have changed and have not been able to locate the images anywhere. Goal here is this. I want to turn the image of Moss / DreamGrass / Aroma into another image perferably meteors as my bot already picks up mets on its own. Client sided not server sided I am aware of this and again... NOT interested in scamming just botting 2nd...
|
All times are GMT +1. The time now is 16:07.
|
|