1. RE: Scrollbar 'Handle' Size

Don Phillips wrote:
> 
> Yes, it is possible, but its a pain.  I might still have some old code 
> to do this laying around in one of my folders.  I will see if I can dig 
> it up somewhere.  It involves a bit of math, but nothing too fancy.
> And that doo-hickey's technical term is 'Scroll Box' (or sometimes 
> called a 'thumb').

Thanks, Don. That would be great.

Scroll Box, scroll box, scroll box... 
I mean: thumb, thumb, thumb...

I'll try to remember that.

-Ron T.

new topic     » topic index » view message » categorize

2. RE: Scrollbar 'Handle' Size

For those who might not have the current win32lib beta, here is a 
routine based on one that is now included in that library...

--/proc setWindowScrollRange( id, typeScroll, min, max, pageSize)
--/desc Set range of window scrollbar or normal scrollbar .
--/li id: specifies either the scrollbar or /Window with scrollbar
--/li typeScroll : specifies type of the scrollbar
--/li pageSize : specifies size of one page (allows to set size of 
proportional scrollbar)
-- If this is less than 1, it is ignored.
--
--typeScroll can be one of the following :
-- /li  SB_HORZ : window's (specified by id) horizontal scrollbar
-- /li  SB_VERT : window's (specified by id) vertical scrollbar
-- /li  SB_CTL  : control (specified by id), either HScroll or VScroll

global procedure setWindowScrollRange(integer id, integer typeScroll, 
integer min,
integer max, atom pageSize)

    atom sif
    atom lMask
    sequence lChangeSize

    -- Allocate structure
    sif = acquire_mem(0, SIZEOF_SCROLLINFO )
    
    -- store values           
    if pageSize < 1 then
        lMask = SIF_RANGE
    else
        lMask = or_all({SIF_RANGE,SIF_PAGE})
    end if
    
    store( sif, sifSize, SIZEOF_SCROLLINFO )
    store( sif, sifMask, lMask )
    store( sif, sifMin, min )
    store( sif, sifMax, max )
    store( sif, sifPage, pageSize)
    
    
    VOID = w32Func( xSetScrollInfo,
                      {   getHandle( id ),            -- handle
                    typeScroll,                     --
                    sif,                        -- pointer to structure
                    0 } )                       -- redraw flag
    
    -- Free structure
    release_mem( sif )
end procedure

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

3. RE: Scrollbar 'Handle' Size

Euman! Good to hear from you! Thought you had dropped off. Glad to know
you're still alive and programmin' like a fiend. :)

>
> http://www.rapideuphoria.com/winapi5.zip
>
> and this is the code you should be looking at:
>
>    elsif iMsg = WM_HSCROLL then
>
>        scroll_param = LOWORD(wParam)
>
>           if scroll_param = SB_THUMBTRACK or scroll_param =
> SB_THUMBPOSITION then
>              orgX = HIWORD(wParam)
>              if orgX < 0 then orgX = 0 end if
>
>           elsif scroll_param = SB_LINERIGHT then
>
>              if orgX < vxScreen-peek4s(rect_Right) then
>               orgX += 1
>              end if
>
>           elsif scroll_param = SB_LINELEFT then
>
>              if orgX > 0 then
>               orgX -= 1
>              end if
>
>           elsif scroll_param = SB_PAGERIGHT then
>
>              if orgX + 15 < vxScreen-peek4s(rect_Right) then
>               orgX += 15
>              end if
>
>           elsif scroll_param = SB_PAGELEFT then
>
>               if orgX > 0 then
>                  if orgX - 15 > 0 then
>                   orgX -= 15
>                  else
>                     orgX -= 1
>                  end if
>               end if
>
>           end if
>
>           poke4(sifMask, SIF_POS)
>           poke4(sifPos, orgX)
>           ok = c_func(xSetScrollInfo,{hwnd, SB_HORZ, si, 1})
>
>           return c_func(xInvalidateRect, {hwnd, NULL, 0})
>
>
>     elsif iMsg = WM_VSCROLL then
>
>        scroll_param = LOWORD(wParam)
>
>           if scroll_param = SB_THUMBTRACK or scroll_param =
> SB_THUMBPOSITION then
>              orgY = HIWORD(wParam)
>
>              if orgX < 0 then orgX = 0 end if
>
>           elsif scroll_param = SB_LINEDOWN then
>              if orgY < vyScreen-peek4s(rect_Bottom) then
>               orgY += 1
>              end if
>
>           elsif scroll_param = SB_LINEUP then
>              if orgY > 0 then
>               orgY -= 1
>              end if
>
>           elsif scroll_param = SB_PAGEDOWN then
>              if orgY + 15 < vyScreen-peek4s(rect_Bottom) then
>               orgY += 15
>              end if
>
>           elsif scroll_param = SB_PAGEUP then
>
>              if orgY > 0 then
>                 if orgY - 15 > 0 then
>                  orgY -= 15
>                 else
>                    orgY -= 1
>                 end if
>              end if
>
>           elsif scroll_param = SB_TOP then
>            orgY = 0
>
>           elsif scroll_param = SB_BOTTOM then
>            orgY = (vyScreen/2) + peek4s(rect_Bottom) - 65
>
>           end if
>
>           poke4(sifMask, SIF_POS)
>           poke4(sifPos, orgY)
>           ok = c_func(xSetScrollInfo,{hwnd, SB_VERT, si, 1})
>
>           return c_func(xInvalidateRect, {hwnd, NULL, 0})
>
<snip>

>
>

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

4. RE: Scrollbar 'Handle' Size

euman at bellsouth.net wrote:

Hey euman"
Welcome back!
Did you see the posts awhile back with a topic
of "RS-232C serial text strings". If not search the archive
for the messages. Someone needs your help with interfacing
Windows RS-232C serial strings to interface with a PLC
Controller. It sounds like something you can help them with.

Bernie

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

5. RE: Scrollbar 'Handle' Size

Thanks to everyone who responded!

I've got something working now, although it's not as accurate as I'd
like (strickly my fault!). I believe, however, that I can live with it.

I guess I won't be the first to express this sentiment while dealing
with the MS Win32 environment. smile

-Ron T.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu