Author Topic: Status_Bar reference issue.  (Read 3870 times)

0 Members and 1 Guest are viewing this topic.

Offline James C. Fuller

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 599
  • User-Rate: +11/-8
Status_Bar reference issue.
« on: October 25, 2014, 09:36:47 PM »

  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: [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))

Offline José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2522
  • User-Rate: +209/-0
  • Gender: Male
Re: Status_Bar reference issue.
« Reply #1 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.