i have Button for each Drive
when add / remove USB Drive i want to "End()" BTNBMP and create new depend on Drive Letter
- Code: Select all Expand view RUN
- oMain:bOnDeviceChange := { | o, w, l | OnDeviceChange( o, w, l ), oMain:Refresh() }
this "seem" to work but there is no ACTION any more ...
- Code: Select all Expand view RUN
- PROCEDURE DriveButton()
LOCAL aDrives := FillDriveArray()
LOCAL ii, iMax
LOCAL oBtn
LOCAL acItem, cDrive
LOCAL acBitmaps, cBitmap
LOCAL acType
LOCAL nFirstUSB
LOCAL aBlocks, bBlock, cBlock
LOCAL nWidth := oMain:nWidth
IF ! EMPTY(aBtnDrives)
iMax := LEN(aBtnDrives)
FOR ii := iMax TO 1 STEP -1
oBtn := aBtnDrives[ii]
oBtn:End()
A_Remove(aBtnDrives,ii)
NEXT
aBtnDrives := {}
ENDIF
acItem := aDrives[ 1 ]
acBitmaps := aDrives[ 2 ]
acType := aDrives[ 3 ]
nFirstUSB := aDrives[ 4 ]
aBtnDrives := {}
iMax := LEN( acItem )
nGridFocus := 1
ii := 1
FOR ii := 1 TO iMax
cDrive := SUBSTR( acItem[ ii ], 1, 2 ) + ´\´
cBitmap := acBitmaps[ ii ]
@ 40, ( ii - 1 ) * ( ( nBB * 2 ) + 2 ) BTNBMP oBtn SIZE nBB * 2, nBB PIXEL OF oMain ;
PROMPT cDrive LEFT ;
RESNAME cBitmap ;
FONT oFontDefault COLOR BFcolor, BGcolor
oBtn:bClrGrad := bGradient
bBlock := DoDetachLocal( cDrive )
oBtn:bAction := bBlock
__ChangeStyleWindow( oBtn:hWnd, WS_TABSTOP,, .F. )
AADD( aBtnDrives, oBtn )
NEXT
nGridFocus := 2
ii := 1
FOR ii := 1 TO iMax
cDrive := SUBSTR( acItem[ ii ], 1, 2 ) + ´\´
cBitmap := acBitmaps[ ii ]
@ 40, ( nWidth / 2 ) +( ( ii - 1 ) * ( ( nBB * 2 ) + 2 )) BTNBMP oBtn SIZE nBB * 2, nBB PIXEL OF oMain ;
PROMPT cDrive LEFT ;
RESNAME cBitmap ;
FONT oFontDefault COLOR BFcolor, BGcolor
oBtn:bClrGrad := bGradient
bBlock := DoDetachLocal( cDrive )
oBtn:bAction := bBlock
__ChangeStyleWindow( oBtn:hWnd, WS_TABSTOP,, .F. )
AADD( aBtnDrives, oBtn )
NEXT
nGridFocus := 1
RETURN
- Code: Select all Expand view RUN
- STATIC FUNCTION DoDetachLocal( cDrive )
LOCAL cBlock := "{|o| DoDoDo('" + cDrive + "') }"
LOCAL bBlock
bBlock := &cBlock
RETURN bBlock
PROCEDURE DoDoDo( cDrive )
IF nGridFocus = 1
oExpl_Left:DoNextFolder( cDrive )
ELSE
oExpl_Right:DoNextFolder( cDrive )
ENDIF
RETURN