AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[Tips N Tricks] How to set a 'Tiled background' for GUI ?
Goto page Previous  1, 2, 3 ... 28, 29, 30, 31, 32, 33  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Trente
Guest





PostPosted: Wed May 26, 2010 9:10 pm    Post subject: Reply with quote

tank wrote:


in its most simplistic form
Code:
#InstallMouseHook
SetTimer,mouse,10
mouse:
   if !drag := GetKeyState("LButton", "P")
      ToolTip % "Mouse Up"
   Else ToolTip % "Holding down"
Return





How exactly would that integrate with SKAN's code snippet? Your code suggests that it would apply in general to clicking or dragging. But SKAN's code is specific to each image being dragged. In addition, I would need to seperate clicking on one of those images versus clicking on a blank area of the screen.

I need something that integrates on a per-image basis - I think.
Back to top
tank



Joined: 21 Dec 2007
Posts: 3700
Location: Louisville KY USA

PostPosted: Wed May 26, 2010 10:10 pm    Post subject: Reply with quote

and so your saying you have no imagination to try figure it out? why should we do it all for you then maybe someone else will i wont
_________________

We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Thu May 27, 2010 12:21 am    Post subject: Re: How to enable Drag for a Static Control ? Reply with quote

Trente wrote:
SKAN wrote:
How to enable Drag for a Static Control ?
http://www.autohotkey.com/forum/viewtopic.php?p=123732#123732


SKAN, I have a few questions for you about this wonderful snippet of code...

1. How can I distinguish between the drag action, and a click action? And since it seems that all dragable images would have the same action code, is there a way to reference the variable of whichever image was clicked?

2. If I drag an image passing completely over another one, there are no glitches. But if I let go of the drag while one image is on top of another, then as soon as I drag that top image away, it retains whatever portion of the bottom image it was covering. I have to click that top image a second time in order to clear that. Is there a way to fix that visual glitch?


Redrawing the control before & after drag fixes the visual glitch.. for the rest of your queries, the following code should answer:

Code:
Gui, Add, Picture, Icon vCalc gMPPS, calc.exe
Gui, Add, Picture, Icon vNotepad gMPPS, notepad.exe
Gui, Show, w400 h300, Click to Launch or Long-Click to Move
Return

MPPS: ; Mobile-Phone-Power-Switch, which provides dual functionality. A short-press of the
      ; Power button shows you a menu whereas a long-press would shut-off the Mobile phone
  TC:=A_TickCount, App:=A_GuiControl
  MouseGetPos,,,,sHwnd1, 2
  While LongClick := GetKeyState( "LButton","P" )
   If (A_TickCount-TC) > DllCall("GetDoubleClickTime")
    Break
  IfNotEqual,LongClick,1, GoTo, AppLaunch
ControlMove:
  MouseGetPos,,,,sHwnd2, 2
  IfNotEqual, sHwnd2, %sHwnd1%, Return
  SoundBeep 500
  Winset,Redraw,,ahk_id %sHwnd1%
  SendMessage, 0x112,0xF012,0,,ahk_id %sHwnd1% ; [ WM_SYSCOMMAND+SC_MOVE ]
  Winset,Redraw,,ahk_id %sHwnd1%
Return

AppLaunch:
 IfEqual,App,Notepad, Run,notepad.exe
 IfEqual,App,Calc,    Run,calc.exe
Return


Another - simpler way - for differentiating between click and click-drag is to use a modifier key:

Code:
Gui, Add, Picture, Icon vCalc gAppLaunch, calc.exe
Gui, Add, Picture, Icon vNotepad gAppLaunch, notepad.exe
Gui, Show, w400 h300, Click to Launch or Long-Click to Move
Return

AppLaunch:
 If GetKeyState( "Control","P" )
    GoTo, ControlMove
 App := A_GuiControl
 IfEqual,App,Notepad, Run,notepad.exe
 IfEqual,App,Calc,    Run,calc.exe
Return

ControlMove:
  MouseGetPos,,,,sHwnd, 2
  Winset,Redraw,,ahk_id %sHwnd%
  SendMessage, 0x112,0xF012,0,,ahk_id %sHwnd% ; [ WM_SYSCOMMAND+SC_MOVE ]
  Winset,Redraw,,ahk_id %sHwnd%
Return


Last edited by SKAN on Thu May 27, 2010 1:14 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
TLM



Joined: 21 Aug 2006
Posts: 2926
Location: The Shell

PostPosted: Thu May 27, 2010 12:38 am    Post subject: Reply with quote

hrmm would this also fix the 'glitch'?
Code:
...
; http://msdn.microsoft.com/en-us/library/dd145167(v=VS.85).aspx
dllCall("UpdateWindow", UInt, sHwnd1)
...

Just wondering..
_________________
paradigm.shift:=(•_•)┌П┐RTFM||^.*∞
Back to top
View user's profile Send private message
Trente
Guest





PostPosted: Thu May 27, 2010 4:02 am    Post subject: Reply with quote

tank wrote:


and so your saying you have no imagination to try figure it out? why should we do it all for you then maybe someone else will i wont




It's not about imagination, it's about programming knowledge and skill. I'm not asking others to do my work for me, but if I'm having difficulty figuring out how something works, I ask for help.

In case it slipped past you, this part of the forum is for people asking for help. If this is your attitude when it comes to people less skilled than you, it might be best if you spent your time elsewhere.
Back to top
Trente
Guest





PostPosted: Thu May 27, 2010 4:06 am    Post subject: Re: How to enable Drag for a Static Control ? Reply with quote

SKAN wrote:


Redrawing the control before & after drag fixes the visual glitch.. for the rest of your queries, the following code should answer:

Another - simpler way - for differentiating between click and click-drag is to use a modifier key:




Thank you, SKAN. That helped me to understand better.

If it's not possible to do a true drag vs click, then I think the second method works better for me since it's less awkward (not to mention faster) to use a modifier key than to wait for a long click.


Honestly, thank you for taking the time to enlighten me. Smile
Back to top
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Thu May 27, 2010 6:02 am    Post subject: Re: How to enable Drag for a Static Control ? Reply with quote

Trente wrote:
not possible to do a true drag vs click


I did not tell that. I do not know your application.
Mine is Picture Puzzle where I use 'drag control' to swap picture tiles.
Try the following:

Code:
Gui, Add, Picture, Icon vCalc gAppLaunch, calc.exe
Gui, Add, Picture, Icon vNotepad gAppLaunch, notepad.exe
Gui, Show, w400 h300, Click to Launch or Long-Click to Move
Return

AppLaunch:
 App := A_GuiControl, Count := pX := pY := 0
 ; Scan for mouse movement while Left-Mouse-Button is down
 While GetKeyState( "LButton","P" ) {
   MouseGetPos,X,Y,,sHwnd, 2
   Count := ( X<>pX || Y<>pY ) ? Count+1 : Count, pX:=X, pY:=Y
   IfGreater, Count, 3, GoTo, ControlMove ; Movement detected.., Trigger Control Move
 }
 IfEqual,App,Notepad, Run,notepad.exe
 IfEqual,App,Calc,    Run,calc.exe
Return

ControlMove:
 MouseGetPos,,,,sHwnd, 2
 Winset,Redraw,,ahk_id %sHwnd%
 SendMessage, 0x112,0xF012,0,,ahk_id %sHwnd% ; [ WM_SYSCOMMAND+SC_MOVE ]
 Winset,Redraw,,ahk_id %sHwnd%
Return


Quote:
the second method works better for me since it's less awkward


Awkward? A Mobile-phone-switch is not awkward in a mobile phone Smile..., again, I do not know your application. I was just experimenting possibilities.

Quote:
Honestly, thank you for taking the time to enlighten me. Smile


Honestly, I am pleased when somebody finds 'help' in my post. Most of my replies in Ask-for-help do not attract a reply from the original poster. Sad
Back to top
View user's profile Send private message Send e-mail
sinkfaze



Joined: 18 Mar 2008
Posts: 5044
Location: the tunnel(?=light)

PostPosted: Thu May 27, 2010 2:10 pm    Post subject: Reply with quote

Trente wrote:
In case it slipped past you, this part of the forum is for people asking for help.


Just to clarify Trente, the Scripts & Functions forum is NOT the forum for people asking for help. Ask for Help is the correct forum.
_________________
Try Quick Search for Autohotkey or see the tutorial for newbies.
Back to top
View user's profile Send private message Send e-mail
TLM



Joined: 21 Aug 2006
Posts: 2926
Location: The Shell

PostPosted: Thu May 27, 2010 5:35 pm    Post subject: Reply with quote

Agreed!

This thread is way too important to be sullied with help requests.
_________________
paradigm.shift:=(•_•)┌П┐RTFM||^.*∞
Back to top
View user's profile Send private message
Trente
Guest





PostPosted: Fri May 28, 2010 1:58 pm    Post subject: Reply with quote

sinkfaze wrote:
Trente wrote:
In case it slipped past you, this part of the forum is for people asking for help.


Just to clarify Trente, the Scripts & Functions forum is NOT the forum for people asking for help. Ask for Help is the correct forum.


I realized that about two seconds after hitting "Submit", but it was too late. Smile

My apologies. However, I still maintain that it was a poor attitude to have.
Back to top
Trente
Guest





PostPosted: Fri May 28, 2010 1:58 pm    Post subject: Reply with quote

TLM wrote:
Agreed!

This thread is way too important to be sullied with help requests.


I understand. I'm moving this discussion to another thread.
Back to top
Trente
Guest





PostPosted: Fri May 28, 2010 2:00 pm    Post subject: Re: How to enable Drag for a Static Control ? Reply with quote

SKAN wrote:
Trente wrote:
not possible to do a true drag vs click


I did not tell that. I do not know your application.



SKAN, let's continue this here:
http://www.autohotkey.com/forum/topic58614.html
Back to top
AaronStarr



Joined: 21 Jun 2010
Posts: 58
Location: Toledo, OH USA

PostPosted: Thu Jun 24, 2010 5:23 am    Post subject: Replace Win Start Button Reply with quote

Quote:
How to Hide , Disable or Replace Windows Start Button ?
http://www.autohotkey.com/forum/viewtopic.php?p=54863#54863


I figured out how to change the Size and 12 hour (from 24 hour) of the Taskbar/Start Clock, but how do you change the look? Say I wanted to use my own PNG as the button background.

Thanks. I'm stumped.

Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Thu Jun 24, 2010 5:38 am    Post subject: Reply with quote

You could try Graphic Buttons : http://www.autohotkey.com/forum/viewtopic.php?t=4047
Back to top
View user's profile Send private message Send e-mail
AaronStarr



Joined: 21 Jun 2010
Posts: 58
Location: Toledo, OH USA

PostPosted: Thu Jun 24, 2010 6:17 am    Post subject: Thanks Reply with quote

SKAN wrote:
You could try Graphic Buttons : http://www.autohotkey.com/forum/viewtopic.php?t=4047


Great. Thanks for the pointing that out. Your code is Awesome too.

Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3 ... 28, 29, 30, 31, 32, 33  Next
Page 29 of 33

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group