Theo's Forum

IT-Consultant: José Roca (PBWIN 10+/PBCC 6+) (Archive only) => Windows API Headers => Topic started by: James C. Fuller on October 25, 2014, 09:36:47 PM

Title: Status_Bar reference issue.
Post by: James C. Fuller on October 25, 2014, 09:36:47 PM

José,
  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.

James

Code: [Select]
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 Sub

Title: Re: Status_Bar reference issue.
Post by: José Roca on October 26, 2014, 03:30:03 AM
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.