1. SetScrollPos

------=_NextPart_000_000C_01BFCA6A.9F61E3C0
        charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable

I created window with style WS_VSCROLL.
When it receives message WM_VSCROLL I want to set position of thumb box =
of scrollbar with this function:
SetScrollPos(hwnd,SB_VERT,50,1)
    -hwnd=3Dwindow that received message

,but it doesnt work, neither does this work:
SendMessage(hwnd, TBM_SETPOS, true, 10 )

Any suggestions?

------=_NextPart_000_000C_01BFCA6A.9F61E3C0
        charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-2" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3401" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3D"Lucida Casual" size=3D2>
<DIV>I created window with style WS_VSCROLL.</DIV>
<DIV>When it receives message WM_VSCROLL I want to set position of thumb =
box of=20
scrollbar with this function:</DIV>
<DIV>SetScrollPos(hwnd,SB_VERT,50,1)</DIV>
<DIV>&nbsp;&nbsp;&nbsp; -hwnd=3Dwindow that received message</DIV>
<DIV>&nbsp;</DIV>
<DIV>,but it doesnt work, neither does this work:</DIV>
<DIV>SendMessage(hwnd, TBM_SETPOS, true, 10 )</DIV>
<DIV>&nbsp;</DIV>

------=_NextPart_000_000C_01BFCA6A.9F61E3C0--

new topic     » topic index » view message » categorize

2. Re: SetScrollPos

On Tue, 30 May 2000 19:09:47 +0200, <tone.skoda at SIOL.NET> wrote:

>I created window with style WS_VSCROLL.
>When it receives message WM_VSCROLL I want to set position of thumb box of
>scrollbar with this function:
>SetScrollPos(hwnd,SB_VERT,50,1)
>    -hwnd=window that received message
>
>,but it doesnt work, neither does this work:
>SendMessage(hwnd, TBM_SETPOS, true, 10 )
>
>Any suggestions?

At one time I, myself, asked:

> If I create a window with a vertical scrollbar
> (WS_VSCROLL), am I able to use it?  How do I get
> it's handle?

To which David Cuny replied:

These aren't wrapped in a nice sort of way. You have to trap the events
yourself, using onEvent. The scrollbar is an attribute of the window, not a
seperate control. You can get the handle of the window using getHandle().

--------------------

I never did do anything with this advice because at the time I was quite a
novice at Win32 programming.  But now I could probably code up an example
if you still can't figure it out...

-- Brian

new topic     » goto parent     » topic index » view message » categorize

3. Re: SetScrollPos

I don't know if you're trying this with win32lib, but if function
GetScrollPosition() ended with:

-- NEW! 0.50c
    elsif window_type[ id ] = ProgressBar then

        return sendMessage( id, PBM_GETPOS, 0, 0 )

    else return -1 ---*** added line here !!!

    end if

end function

... it should work OK.

Wolf

----------
From: ©koda <tone.skoda at SIOL.NET>

new topic     » goto parent     » topic index » view message » categorize

4. Re: SetScrollPos

Here's an example that will work *IF* win32lib is patched the way I suggested
in my previous posting.

include win32lib.ew
object junk

constant
win1=create(Window,"hello",0,10,10,200,200,
             or_all({WS_TILEDWINDOW,WS_VSCROLL}))


procedure ok(atom event,atom wParam,atom lParam)
if event=WM_VSCROLL then
end if
end procedure

onEvent[win1]=routine_id("ok")

WinMain(win1,Normal)

new topic     » goto parent     » topic index » view message » categorize

5. Re: SetScrollPos

On Tue, 30 May 2000 19:35:24 -0400, wolfgang fritz wrote:

>I don't know if you're trying this with win32lib, but if function
>GetScrollPosition() ended with:
>
>-- NEW! 0.50c
>    elsif window_type[ id ] = ProgressBar then
>
>        return sendMessage( id, PBM_GETPOS, 0, 0 )
>
>    else return -1 ---*** added line here !!!
>
>    end if
>
>end function
>
>... it should work OK.
>
>Wolf

Thanks for the patch, Wolf.  I was trying to do an example and just
couldn't figure out what the heck was going on (I got different behavior
from version .44, .45 and .50).  Version .45r was giving me the divide by
zero in getScrollPosition and version .50c was giving me a 'function must
return a value' error.

...and you provided the example on top of it!!!  Kudos...

--  Brian

new topic     » goto parent     » topic index » view message » categorize

6. Re: SetScrollPos

I am not using Win32Lib, but your example is very useful.
In my program it still doesn't work.
It's not in WinProc in Win32Lib, cause it does nothing!
I set another procedure for window with SetWinowLong and it worked, so the
problem must be in window creation.
We don't need SetScrollRange or SetScrollInfo.
I really don't know where the problem is. For 2 hours I have been exploring
Win32Lib and havent found where it does that magic trick that makes the
scroll box move!

Could you do an example from the ground, creating your class for window and
your window, with xCreateWindow, and your own WndProc?

new topic     » goto parent     » topic index » view message » categorize

7. Re: SetScrollPos

Make sure last parameter in SetScrollPos function for redrawing thumb
 ( bRedraw ) has been set TRUE

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu