Re: Win32Lib Error Fixes

new topic     » goto parent     » topic index » view thread      » older message » newer message

C Bouzy wrote:
> 
> Hello All,
> 
> Today I began using the latest Win32Lib for Nexus Radio and I found two
> errors.
> 
> 
> Look for the procedure setScrollRange and find: 
> }}}
<eucode>
> ctrl_Range[ id ][1] = { min, max }
> </eucode>
{{{

> 
> Replace it with:
> }}}
<eucode>
> ctrl_Range[ id ][1] = { min, max }
> ctrl_Range[ id ][2] = { min, max }
> </eucode>
{{{

> 

Are you sure?
First, there are several instances of the statment in the routine. Which one is
supposed to be completed?
Second, ctrl_Range[id] holds either:
* for Window controls, a pair of ranges, for H and V scroll bars;
* For other usable controls, a single range, they have only one to monitor.

I checked further, and I think the error is in getScrollRange rather, which
should read as
global function getScrollRange( object id )

    -- Get the allowable range for a scroll bar
    atom lWhichBar

    if sequence(id) then
        lWhichBar = w32iff(find(id[2], {SB_VERT,SB_HORZ}), id[2], SB_VERT)
        id = id[1]
    else
        lWhichBar = SB_VERT
    end if
-- changed part
    if ctrl_Family[id]=WINDOW then
        if lWhichBar = SB_HORZ then
            return ctrl_Range[id][2]
        else
            return ctrl_Range[id][1]
        end if
    else
        return ctrl_Range[id][1]
    end if
end function


See if this isn't a better fix, I expect it is.

> Also replace the DefProcessing function with the follow code:
> 
> }}}
<eucode>
> -----------------------------------------------------------------------------
> function DefProcessing(integer id, integer pSource, atom hWnd, atom iMsg, atom
> wParam, atom
> lParam)
> -----------------------------------------------------------------------------
> atom lResult
> lResult = 0
> 
>     if (id = 0) or (pSource = kMainMsg) then
>         lResult = w32Func( xDefWindowProc, { hWnd, iMsg, wParam, lParam } )
>     else
>         lResult = w32Func( xCallWindowProc, { ctrl_Function[id], hWnd, iMsg,
>         wParam,
> lParam } )
>     end if
> 
>     if lResult = 0
>       then
>        return 0
>         else
>       return lResult
>     end if
> end function
> r_defaultProcessing = routine_id("DefProcessing")
> </eucode>
{{{

> 

The second chunk of code looks like an  uselessly complex way to return lResult.
Does it make a difference?
I added the lResult=0 initialisation.

CChris

> ~ CBouzy
> 
> "If you do what you have always done, you will get what you always got."

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu