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 

Scrolling a control's content in pixel-steps
Goto page 1, 2  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Tekl



Joined: 24 Sep 2004
Posts: 813
Location: Germany

PostPosted: Fri Mar 04, 2005 8:36 am    Post subject: Scrolling a control's content in pixel-steps Reply with quote

Hello,

is it true that it is not possible to scroll a control pixel by pixel? I googled for WM_VSCROLL and found a newsgroup-thread where someone claimed it is not possible.

Tekl


Last edited by Tekl on Fri Mar 04, 2005 1:09 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
BoBo
Guest





PostPosted: Fri Mar 04, 2005 9:08 am    Post subject: Reply with quote

Quote:
GuiControl, Sub-command, ControlID [, Param3]

Move: Moves and/or resizes the control. Specify one or more of the following option letters in Param3: X (the x-coordinate relative to the GUI window's client area, which is the area not including title bar, menu bar, and borders); Y (the y-coordinate), W (Width), H (Height). Example: x10 y20 w200 h100


Code:
Gui, Add, Button, Default vMyButton, &OK

Loop, 30
{
GuiControl, Move, MyButton, x%A_Index% y10
}


I guess you've tested already something similar ...
Back to top
Tekl



Joined: 24 Sep 2004
Posts: 813
Location: Germany

PostPosted: Fri Mar 04, 2005 10:11 am    Post subject: Reply with quote

Hi Bobo,

I don't want to move or resize a control. I want to scroll the content of a control and it should not only work in the ahk-gui.

Tekl
Back to top
View user's profile Send private message Visit poster's website
BoBo
Guest





PostPosted: Fri Mar 04, 2005 10:36 am    Post subject: Reply with quote

Quote:
Control
--------------------------------------------------------------------------------
Makes a variety of changes to a control.

Control, Cmd [, Value, Control, WinTitle, WinText, ExcludeTitle, ExcludeText]

Choose, N: Sets the selection in a ListBox or ComboBox to be the Nth entry. N should be 1 for the first entry, 2 for the second, etc. To select or deselect all items in a multi-select listbox, follow these examples:
PostMessage, 0x185, 1, -1, ListBox1, WinTitle ; Select all listbox items. 0x185 is LB_SETSEL.
PostMessage, 0x185, 0, -1, ListBox1, WinTitle ; Deselect all listbox items.

ChooseString, String: Sets the selection (choice) in a ListBox or ComboBox to be the entry whose leading part matches String. The search is not case sensitive. For example, if a ListBox/ComboBox contains the item "UNIX Text", specifying the word unix (lowercase) would be enough to select it.
So that won't cover it as well ?
Back to top
BoBo
Guest





PostPosted: Fri Mar 04, 2005 10:45 am    Post subject: Reply with quote

Ehm, have ignored the "pixel steps"-requirement. So the above won't cover it, definitely Embarassed

@ Toralf
maybe you can edit the topic to: Scrolling a control's content in pixel-steps
I guess you mean a Teleprompter look-a-like. Wink
Back to top
toralf



Joined: 31 Jan 2005
Posts: 3841
Location: Bremen, Germany

PostPosted: Fri Mar 04, 2005 11:38 am    Post subject: Reply with quote

Please BoBo,
I'm neither Titan nor Tekl.
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
BoBo
Guest





PostPosted: Fri Mar 04, 2005 12:11 pm    Post subject: Reply with quote

@ toralf
von wem war nochmal der Song: "You are always on my mind" ???
Sorry, war keine böse Absicht.
Also, machs gut Chris (just kidding) Wink Laughing
Back to top
Tekl



Joined: 24 Sep 2004
Posts: 813
Location: Germany

PostPosted: Fri Mar 04, 2005 1:13 pm    Post subject: Reply with quote

Pet Shop Boys? Elvis?
Back to top
View user's profile Send private message Visit poster's website
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10480

PostPosted: Fri Mar 04, 2005 9:47 pm    Post subject: Re: Scrolling a control's content in pixel-steps Reply with quote

Tekl wrote:
is it true that it is not possible to scroll a control pixel by pixel?
I don't know the answer, but it wouldn't surprise me if that were true.

If you haven't already, the following topic shows how to post the VSCROLL message directly to a control:
http://www.autohotkey.com/forum/viewtopic.php?t=136
Back to top
View user's profile Send private message Send e-mail
Tekl



Joined: 24 Sep 2004
Posts: 813
Location: Germany

PostPosted: Sat Mar 05, 2005 10:54 pm    Post subject: Reply with quote

Hi Chris,

I tried it with VSCROLL, but it has only SB_LINEUP/DOWN and I need something like SB_PIXELUP/DOWN. SB_THUMBTRACK doesn't seem to work and I don't know how to use it. In the net I found something about scrolling RichEdit-controls with EM_SETSCROLLPOS, but I don't know how to get its number for AHK's SendMessage.

http://groups.google.de/groups?q=sendmessage+scroll+pixel+by+pixel&start=20&hl=de&lr=&selm=u7pD5.109034%24zJ5.5005485%40news.chello.at&rnum=34

Tekl
Back to top
View user's profile Send private message Visit poster's website
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10480

PostPosted: Sun Mar 06, 2005 3:19 am    Post subject: Reply with quote

I read that post; based on it and the MSDN info I've read in the past, I doubt pixel scrolling is possible without overriding the control's WindowProc and substituting your own scrolling functions.

I believe the system provides the means to globally override all controls of a certain class (across the entire system). For example, it might be possible to write a program that alters all Edit controls to have pixel scroll capability. But the level of difficulty would likely be high.
Back to top
View user's profile Send private message Send e-mail
Tekl



Joined: 24 Sep 2004
Posts: 813
Location: Germany

PostPosted: Sun Mar 06, 2005 4:33 pm    Post subject: Reply with quote

Hi Chris,

so that's nothing for me. Smile I've tried to examine how Opera will do it but without any success, maybe due to my limited knowledge about these messages.

Tekl
Back to top
View user's profile Send private message Visit poster's website
Mythos



Joined: 29 Jan 2005
Posts: 22

PostPosted: Tue Mar 08, 2005 10:13 pm    Post subject: Re: Scrolling a control's content in pixel-steps Reply with quote

Tekl wrote:
is it true that it is not possible to scroll a control pixel by pixel?


You can't scroll the content pixel by pixel but you still can position the scrollbar on pixel level straightly.

Try the following script with a small AutoHotkey help window (with visible h/v scrollbars of the content pane for any large help entry). The gesture is CTRL+LButton -> Drag.

We need the current scrollbar position to get it working properly. See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/scrollbars/scrollbarreference/scrollbarmessages/sbm_getpos.asp for details.

Code:

#SingleInstance force

; [SCR] variable prefix

^LButton::
  CoordMode, Mouse, Screen
  MouseGetPos, SCR_MouseStartX, SCR_MouseStartY, SCR_WinID, SCR_ControlName
  If ( !SCR_WinID )
    Return
  SetTimer, SCR_ScrollHandler, 10
Return

SCR_ScrollHandler:
  CoordMode, Mouse, Screen
  MouseGetPos, SCR_MouseX, SCR_MouseY
  GetKeyState, SCR_LButtonState, LButton, P
  GetKeyState, SCR_CtrlState, Ctrl, P
  If ( (SCR_LButtonState = "U") or (SCR_CtrlState = "U") )
    SetTimer, SCR_ScrollHandler, Off
  Else
  {
    SCR_MouseDeltaX := SCR_MouseX - SCR_MouseStartX
    SCR_MouseDeltaY := SCR_MouseY - SCR_MouseStartY
    If ( SCR_MouseDeltaX < 0 )
    { ; 0x114 is WM_HSCROLL
      SCR_wParam := (-SCR_MouseDeltaX << 16) | 4
      SendMessage, 0x114, %SCR_wParam%, , %SCR_ControlName%, ahk_id %SCR_WinID%
    }
    If ( SCR_MouseDeltaY < 0 )
    { ; 0x115 is WM_VSCROLL
      SCR_wParam := (-SCR_MouseDeltaY << 16) | 4
      SendMessage, 0x115, %SCR_wParam%, , %SCR_ControlName%, ahk_id %SCR_WinID%
    }
  }
Return


Last edited by Mythos on Tue Mar 08, 2005 10:15 pm; edited 1 time in total
Back to top
View user's profile Send private message
Titan



Joined: 11 Aug 2004
Posts: 5390
Location: /b/

PostPosted: Tue Mar 08, 2005 10:15 pm    Post subject: Reply with quote

toralf wrote:
Please BoBo,
I'm neither Titan nor Tekl.
Hmm, what's that implying...?
_________________

Back to top
View user's profile Send private message Visit poster's website
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Tue Mar 08, 2005 11:40 pm    Post subject: Reply with quote

It seems to work on roughly half the controls I test it on, and some aren't as smooth. Still, great script, Mythos!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
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