AutoHotkey Community

It is currently May 26th, 2012, 2:40 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: picture button flickers
PostPosted: January 25th, 2009, 2:45 pm 
i made this custom button:

Code:
gui,add, picture,x490 y490 BackgroundTrans  gLabelToExecute vFoldButton, SmallButton_Off.png
gui,show,h547 w794 , New GUI Window 1
return

LabelToExecute:
guicontrol,,FoldButton,SmallButton_On.png
return


there is two problems:
-if i click on the button it changes the pictures, but it always blinks in the area of the original picture.its a rounded button and i made the corners transparent.
-If i release the left mousebutton it should return to the original button (SmallButton_Off.png) i couldnt figure out how to do it.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 25th, 2009, 2:56 pm 
Online
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Con you post samples of PNGs ?

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 25th, 2009, 4:24 pm 
button on
Image

button off
Image


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 25th, 2009, 4:42 pm 
Online
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Code:
SetWorkingDir, %A_ScriptDir%
Gui, Add, Picture,x200 y200 BackgroundTrans AltSubmit gToExecute vFoldButton, SmallButton_Off.png
Gui, Show,, New GUI Window 1
return

ToExecute:
GuiControl,, FoldButton, SmallButton_On.png
Loop {
       If ! GetKeyState( "LBUTTON", "P" )
       Break
       Sleep 50
     }
GuiControl,, FoldButton, SmallButton_Off.png
Return

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 25th, 2009, 5:10 pm 
Offline

Joined: February 26th, 2006, 9:45 am
Posts: 55
Location: Recife Brazil
Just because I know you are expert in graphics. :)
The exchange of images causes flickering
Regards
Noel


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 25th, 2009, 5:47 pm 
SKAN: thank u for the code. works very smooth.
Quote:
The exchange of images causes flickering

other programs use also picture changing without any problem.any idea how to get rid of it.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 25th, 2009, 9:54 pm 
Online
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
GuiControl redraws the control and hence the window background is momentarily visible causing the flicker. I tried with GDI+ to update the image without redrawing and it works - with zero flicker - but the rounded corners of the button lose anti-alias and forms a thick shadow. Not worth the code. :(

Edit: Square/Rectangle works alright.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 25th, 2009, 10:56 pm 
Offline

Joined: February 26th, 2006, 9:45 am
Posts: 55
Location: Recife Brazil
What about:
Code:
Gui, Add, Picture,x200 y200 BackgroundTrans AltSubmit gToExecute , SmallButton_Off.png
Gui, Add, Picture,x200 y200 BackgroundTrans AltSubmit gToExecute , SmallButton_On.png
Gui, Show,, New GUI Window 1
return

ToExecute:
GuiControl, Hide, static2
Loop {
       If ! GetKeyState( "LBUTTON", "P" )
       Break
       Sleep 50
     }
GuiControl, Show, static2
Return

Regards,
Noel


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 26th, 2009, 1:05 am 
the gui looks like this
Image

has the following elements
-background (red carpet)
-table (png transparent background)
-avatars (png transparent background(smaller)
-the buttons

if i do it with Noel's technique and press the button the table disappears (the two avatars stay- although they are partly ON the table)
here is the code if it helps:
Code:
gui,add, picture,x0 y0, table.jpg ;Background
gui,add, picture,x0 y0 BackgroundTrans, TableRT.png ; Table

gui,add, picture,x270 y206 BackgroundTrans vflop1,
gui,add, picture,x323 y206 BackgroundTrans vflop2,
gui,add, picture,x376 y206 BackgroundTrans vflop3,
gui,add, picture,x429 y206 BackgroundTrans vturn,
gui,add, picture,x481 y206 BackgroundTrans vriver,

gui,add, picture,x48 y184 BackgroundTrans vplayerCard1,
gui,add, picture,x65 y184 BackgroundTrans vplayerCard2,

gui,add, picture,x678 y184 BackgroundTrans vcpuCard1, 7d.png
gui,add, picture,x695 y184 BackgroundTrans vcpuCard2, back.png

gui,add, picture,x0 y210 BackgroundTrans vseat1, SeatRT_Off.png
gui,add, picture,x628 y210 BackgroundTrans vseat2, SeatRT_Off.png

gui,add, picture,x105 y227 BackgroundTrans vavatar1, avatar1.png
gui,add, picture,x735 y227 BackgroundTrans vavatar2, avatar2.png

gui,add, picture,x490 y490 BackgroundTrans  AltSubmit gToExecute , SmallButton_On.png
gui,add, picture,x490 y490 BackgroundTrans  AltSubmit gToExecute , SmallButton_Off.png

gui,add, picture,x594 y490 BackgroundTrans, SmallButton_Off.png
gui,add, picture,x699 y490 BackgroundTrans, SmallButton_Off.png


gui, font,c0xFFFFFF s6, 
gui, add, text, x39 y233  BackgroundTrans,PLayer1
gui, add, text, x669 y233  BackgroundTrans,Player2
gui, font,c0xFFFFFF s6 bold , 
gui, add, text, x35 y248  BackgroundTrans,$40,000
gui, add, text, x675 y248  BackgroundTrans,$137
 
gui,show,h547 w794 , New GUI Window 1 ;

return


ToExecute:
GuiControl,hide,static3
Loop {
       If ! GetKeyState( "LBUTTON", "P" )
       Break
       Sleep 50
     }
GuiControl,Show,static3

Return


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 26th, 2009, 10:23 pm 
Offline

Joined: February 26th, 2006, 9:45 am
Posts: 55
Location: Recife Brazil
Use Window Spy, (comes with AHK) to see what contol the picture belongs to. Static 1..2 or whatever.
Probably table is using static3.
Regards
Noel


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: G. Sperotto, patgenn123, poserpro, Yahoo [Bot] and 17 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group