• Welcome to Powerbasic Museum 2020-B.
 

News:

Forum in repository mode. No new members allowed.

Main Menu

Status_Bar reference issue.

Started by James C. Fuller, October 25, 2014, 09:36:47 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

James C. Fuller


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


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



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.