Click to See Complete Forum and Search --> : Still not working


hoa01206
August 15th, 2001, 10:54 AM
Hello,

Here is the API function am using. It will move the Grid scroll bar (thumb) but not the contents of the Grid.

Public Declare Function SetScrollPos Lib "user32" (ByVal hwnd As Long, ByVal nBar As Long, ByVal nPos As Long, ByVal bRedraw As Long) As Long
**************************************
Private Sub Command1_Click()
Dim x As Long, y As Long, z As Long
y = Grid1.hwnd
x = 50
z = SetScrollPos(y, 1, x, 1)

End Sub
***************************************

Thanks
Hisham

obiwan444
August 15th, 2001, 11:39 AM
that's because what you are doing is just setting the position of the scrollbar, which causes nothing to happen but the scrollbar to move. what you are probably wanting to happen is the events associated with moving a scrollbar which is the scroll event. you will need to use the SendMessage API function with appropriate parameters to send the grid a scroll message. the entire grid should then scroll.

hope it helps.

-obiwan

hoa01206
August 15th, 2001, 12:02 PM
Could you please tell me what proper message I can send to a flexgrid scroll bar?

I really appreciate your responses.

Thanks
Hisham

obiwan444
August 15th, 2001, 08:40 PM
the flexgrid control is an ActiveX control, and i've found its underlying messages aren't documented. you might be able to figure out what message is being sent by subclassing the control or placing a call to the GetMessage API function inside the scroll event of the flexgrid control.

that's a lot of work. might i ask why you're trying to force the grid to scroll ?

-obiwan

Clearcode
August 16th, 2001, 02:47 AM
Using the window message investifgation tool I posted on palnet source code two days ago I have discovered that if you send a WM_VSCROLL message to an MSFlexGrid control it moves the scrollbar and contents.


private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (byval hwnd as Long, byval wMsg as Long, byval wParam as Long, lParam as Long) as Long


private Const WM_VSCROLL = &h115

'to scroll a grid upwards, wParam is 0
public Sub ScrollGridUp(byval fg as MSFlexGrid)

Dim lRet as Long

lRet = SendMessage(fg.hwnd, WM_VSCROLL,0,0)

End Sub


'to scroll a grid down, wParam is 1
public Sub ScrollGridDown(byval fg as MSFlexGrid)

Dim lRet as Long

lRet = SendMessage(fg.hwnd, WM_VSCROLL,1,0)

End Sub




Hope this helps,
Duncan


-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
Check out the new downloads - ImageMap.ocx is the VB control that emulates an HTML image map, EventVB.OCX for adding new events to your VB form and adding System Tray support simply, MCL Hotkey for implemenmting system-wide hotkeys in your application...all with source code included.

obiwan444
August 16th, 2001, 07:48 AM
thx a lot for this post. gonna go grab ur tool ;)

-obiwan

hoa01206
August 16th, 2001, 08:23 AM
Thank you very much. That's what I was looking for. Thank you again.

Thanks
Hisham

hoa01206
August 16th, 2001, 08:24 AM
Thak you, that worked.

Thanks
Hisham

obiwan444
August 16th, 2001, 08:38 AM
i forgot ... we could have used Microsoft Spy++ ;)

Clearcode
August 16th, 2001, 08:43 AM
Yes - spy allows you to watch messages, but the tool posted on PSC (I would post it here if there was a method of doing so) also allows you to send the message to watch its effect.

HTH,
Duncan

-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
Check out the new downloads - ImageMap.ocx is the VB control that emulates an HTML image map, EventVB.OCX for adding new events to your VB form and adding System Tray support simply, MCL Hotkey for implemenmting system-wide hotkeys in your application...all with source code included.