FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour "disable" Item in Listbox / Combobox
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
"disable" Item in Listbox / Combobox
Posted: 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"

i want to use it for USB-Stick which i want to "safe eject"
greeting,

Jimmy
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: "disable" Item in Listbox / Combobox
Posted: Thu Dec 01, 2022 08:28 AM

Try using GetDriveType() = DRIVE_REMOVABLE.

Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: "disable" Item in Listbox / Combobox
Posted: Thu Dec 01, 2022 01: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 (fw): Select all Collapse
PUBLIC bColorUSB := { || IF( USB_DeviceColor(), SP_nColor2(), SP_nColor13() ) }

 DEFINE GRID Grid_Device
   ...
   DYNAMICFORECOLOR { bColorUSB, bColorUSB }
Xbase++
Code (fw): Select all Collapse
   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

Continue the discussion