In the RibbonBar, I have 12 tabs; when I press Alt (accelerator), Tab 1 doesn't work, but Tab 11 does.
In the RibbonBar, I have 12 tabs; when I press Alt (accelerator), Tab 1 doesn't work, but Tab 11 does.
Mostre como você aciona a Guia 11, porfa.
João, when you press the ALT key, numbers 1 through 11 appear on the tabs. There is a glitch: if you press 11, it navigates to the corresponding tab, but if you press 1, it doesn't.
Fix: TRibbonBar tab keyboard accelerators with 10+ tabs (source\classes\tribbon.prg):
With more than 10 tabs, RunAction() only fired accelerators after two keystrokes
(logic meant for ribbon controls like A0, B1). A single key such as 1 for Tab 1
was treated as a prefix of 10/11/12 and never executed. Fixed: unified prefix/exact
matching in RunAction() and zero-padded tab hints (01-09) in PaintAccTabs() when
there are 10 or more tabs.
METHOD RunAction( nKey ) CLASS TRibbonBar
local nCurrent := 0
local lPartial := .F.
local nLenBuf
if nKey > 95 .and. nKey < 106
nKey -= 48
endif
DEFAULT ::cBufferAcc := ""
If nKey > 0
::cBufferAcc += Chr( nKey )
nLenBuf = Len( ::cBufferAcc )
if nLenBuf == 1
if AScan( ::aAcc, {| uItem | Left( uItem[ 2 ], 1 ) == ::cBufferAcc } ) == 0
::cBufferAcc = ""
return nil
endif
endif
nCurrent = AScan( ::aAcc, {| uItem | uItem[ 2 ] == ::cBufferAcc } )
lPartial = AScan( ::aAcc, {| uItem | Len( uItem[ 2 ] ) > nLenBuf .and. ;
Left( uItem[ 2 ], nLenBuf ) == ::cBufferAcc } ) > 0
if nCurrent > 0 .and. ! lPartial
Eval( ::aAcc[ nCurrent, 1 ] )
elseif nCurrent == 0 .and. ! lPartial
::ResetAcc()
endif
else
::ResetAcc()
endif
return nilMETHOD PaintAccTabs( hDC ) CLASS TRibbonBar
local nTab
local nSizeBox := 20
local nTop := ::nTopMargin - ::nHeightFld + ( nSizeBox / 2 )
local nWidth, nLeft, cAccKey
::aAcc = {}
::cBufferAcc = ""
DrawBitmap( hDC, ::hSaveScr, 0, 0 )
for nTab = 1 to Len( ::aLeft )
nWidth := ::aSizes[ nTab ]
nLeft = ( ( nWidth ) / 2 + ::aLeft[ nTab ] ) - ( nSizeBox / 2 )
cAccKey := if( Len( ::aLeft ) >= 10, PadL( Str( nTab ), 2, "0" ), AllTrim( Str( nTab, 2 ) ) )
RoundRect( hDC, nLeft, nTop, nLeft + nSizeBox, nTop + nSizeBox, 5, 5 )
TextOut( hDC, nTop + 2, nLeft + 2, cAccKey )
AAdd( ::aAcc, AddAction( nTab, Self, cAccKey ) )
next
return nil