"disable" Item in Listbox / Combobox

"disable" Item in Listbox / Combobox

Postby Jimmy » Thu Dec 01, 2022 12:02 am

hi,

when have a Listbox / Combobox with Drive-Letter i want to show all but "disable" all "fix Drive"
Image
i want to use it for USB-Stick which i want to "safe eject"
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: "disable" Item in Listbox / Combobox

Postby Enrico Maria Giordano » Thu Dec 01, 2022 8:28 am

Try using GetDriveType() = DRIVE_REMOVABLE.
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: "disable" Item in Listbox / Combobox

Postby Jimmy » Thu Dec 01, 2022 1:02 pm

hi Enrico,

i do have use GetDriveType to get Drive Type
now i want to change LISTBOX to "show" Removable Drive in other Color

HMG
Code: Select all  Expand view
PUBLIC bColorUSB := { || IF( USB_DeviceColor(), SP_nColor2(), SP_nColor13() ) }

 DEFINE GRID Grid_Device
   ...
   DYNAMICFORECOLOR { bColorUSB, bColorUSB }


Xbase++
Code: Select all  Expand view

   oListBox := MyListbox() :new(...)

METHOD MyListbox:Init(...)
   ::XbpListbox:Init(...)
   ::DrawMode := XBP_DRAW_OWNER
   ::XbpListbox:MeasureItem := { | nItem, aDims, oSelf | oSelf:MyMeasureItem( nItem, aDims, oSelf ) }
   ::XbpListbox:drawItem := { | oPS, aInfo, oSelf | oSelf:MyDrawItem( oPS, aInfo, oSelf ) }

METHOD MyListbox:MyDrawItem( oPS, aInfo, oSelf )
    ...
      IF ::aCargo[ nItem ] [ 3 ] = .F.
         aSAttrs[ GRA_AS_COLOR ] := SP_nColor13()
      ELSE
         aSAttrs[ GRA_AS_COLOR ] := IIF( BAnd( nState, XBP_DRAWSTATE_DISABLED ) != 0, SP_nColor13(), SP_nColor2() )
      ENDIF

      aSAttrs[ GRA_AS_HORIZALIGN ] := GRA_HALIGN_RIGHT
      aSAttrs[ GRA_AS_VERTALIGN ] := GRA_VALIGN_HALF
      aSAttrs[ GRA_AS_ANGLE ] := { 1, 0 }
      aOldAttrs := GRASETATTRSTRING( oPS, aSAttrs )

      oPS:DrawCaptionStr( { nFix * 1, aTxtBox[ 2 ] }, ;
                          { nFix * 2, aTxtBox[ 4 ] }, cStr )

      cVol := ::aCargo[ nItem ] [ 2 ]
      IF EMPTY( cVol )
      ELSE
         oPS:DrawCaptionStr( { nFix * 2, aTxtBox[ 2 ] }, ;
                             { aTxtBox[ 3 ] + IMAGE_BOX, aTxtBox[ 4 ] }, cVol )
      ENDIF

so my Question is : how under FiveWin :?:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 82 guests

cron