IT-Consultant: José Roca (PBWIN 10+/PBCC 6+) (Archive only) > Windows API Headers

Status_Bar reference issue.


James C. Fuller:

  In your Windows API Wrapper Reference StatusBar_SetParts you have three parameters for the PB Syntax but only describe 2 under Parameters.

Also you might want to add a StausBar_SetPartsByPercent. It's what I use. It makes it much simpler. This is my code where I use a ";" as a delimiter. You probably can come up with something better.


--- Code: ---Sub InitStatusBar(BYVAL hCtl AS DWORD,sPropVals AS STRING)

        LOCAL PARTS,x,i,PartCount,hDlg AS LONG
        LOCAL tRect AS RECT
        LOCAL PartSize() AS LONG
        LOCAL nRight AS LONG
        hDlg = GetParent(hCtl)
        PartCount = PARSECOUNT(sPropVals,";")
        REDIM PartSize(PartCount)
        GetClientRect hDlg,tRect
        i = 1
        nRight = tRect.nRight * (VAL(PARSE$(sPropVals,";",i))*.01)
        FOR x = 0 TO PartCount-2
            PartSize(x) = nRight
            INCR i
            nRight += tRect.nRight * (VAL(PARSE$(sPropVals,";",i))*.01)
        NEXT x
        PartSize(PartCount-1) = -1
        SendMessage hCtl,%SB_SETPARTS,PartCount,VARPTR(PartSize(0))

--- End code ---

José Roca:
Thanks for the suggestion.

The parameter missing (dwParts)

Number of parts to set (cannot be greater than 256).

To set the size of the status bar parts I use the CWindow's method SetStatusbarPartsBySize, that is DPI aware.


[0] Message Index

Go to full version