![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
TBAddInsButtons treat Separate as normal buttons [Delphi, KOL]
azsd © (2006-12-05 11:26:00)I added an toolbar on form and assigned toolbarbuttons to action.
but when I add separator item, it just show as normal null button.
for I:= 0 to High( Buttons ) do
begin
if Buttons[ I ] = nil then break;
if Buttons[ I ] = PKOLChar( '-' ) then
begin
PAB.iBitmap := -1;
//PAB.idCommand := 0;
PAB.fsState := 0;
PAB.fsStyle := TBSTYLE_SEP;
PAB.iString := -1;
end
else
begin
Str := Buttons[ I ];
....
end;
....
end
I have set breakpoint on "if Buttons[ I ] = PKOLChar( '-' ) " in KOL.pas,
but It can't stopped at the compare but run to "Str:=Buttons[I]" and I checked the Str value was '-';
I don't know if it something wrong in compiler or kol because Debug Inspector always show I as 2 but I am sure only Buttons[6] is '-', other buttons[I] is just '';
KOL 2.48, Delphi 7.1 (SE), UNICODE_CTRLS.
azsd (2006-12-06 08:34:00) [1]
if (tboTextRight in Options) or
FixFlatXP and {(Align in [caLeft, caRight]) and} (tboFlat in Options) then
S := 'tboTextRight';
if (tboTextBottom in Options) and (S = '') then
S := S + ', tboTextBottom';
if there [tboTextBottom, tboFlat] FixFlatXP combine, the tboTextBottom will be ignored because the (S = '') been break in first fixflatxp operate.
the result pcode in MainUnt*_1.inc will overide to [tboTextRight, tboFlat, tboNoDivider] in NewTooBar call.
I have added "and not(tboTextBottom in Options)" in first line but I am not sure if its an problem or feather.
and
Perform( TB_SETBUTTONSIZE, 200, 0 );
would have no effect because the buttons is already added to toolbar before this message.
previous I added separate width attrib/R/Writer in TKOLToolbarButton because I have to set different width in design time until TBButtonWidth appeared in MCK.
azsd (2006-12-06 06:52:00) [2]TControl.TBSetTooltips in KOL_asm.inc show only one char for unicode.
I added some define switch there then its working now.
procedure TControl.TBSetTooltips(BtnID1st: Integer;
const Tooltips: array of PKOLChar);
asm
PUSH EBX
PUSH ESI
MOV ESI, ECX
MOV EBX, EAX
PUSHAD
MOV ECX, [EBX].fTBttCmd
INC ECX
LOOP @@1
CALL NewList
MOV [EBX].fTBttCmd, EAX
{$IFDEF USE_AUTOFREE4CONTROLS}
XCHG EDX, EAX
MOV EAX, EBX
CALL TControl.Add2AutoFree
{$ENDIF}
{$IFDEF UNICODE_CTRLS}
CALL NewWStrList
{$ELSE}
CALL NewStrList
{$ENDIF}
MOV [EBX].fTBttTxt, EAX
{$IFDEF USE_AUTOFREE4CONTROLS}
XCHG EDX, EAX
MOV EAX, EBX
CALL TControl.Add2AutoFree
{$ENDIF}
@@1: POPAD
MOV ECX, [EBP+8]
INC ECX
JZ @@exit
@@loop:
PUSH ECX
PUSH EDX
PUSH 0
LODSD
MOV EDX, EAX
MOV EAX, ESP
{$IFDEF UNICODE_CTRLS}
CALL System.@WStrFromPWChar
{$ELSE}
CALL System.@LStrFromPChar
{$ENDIF}
MOV EDX, [ESP+4]
MOV EAX, [EBX].fTBttCmd
CALL TList.IndexOf
TEST EAX, EAX
JGE @@2
MOV EDX, [ESP+4]
MOV EAX, [EBX].fTBttCmd
CALL TList.Add
POP EDX
PUSH EDX
MOV EAX, [EBX].fTBttTxt
{$IFDEF UNICODE_CTRLS}
CALL TWStrList.Add
{$ELSE}
CALL TStrList.Add
{$ENDIF}
JMP @@3
@@2:
MOV EDX, EAX
POP ECX
PUSH ECX
MOV EAX, [EBX].fTBttTxt
{$IFDEF UNICODE_CTRLS}
CALL TWStrList.Put
{$ELSE}
CALL TStrList.Put
{$ENDIF}
@@3:
CALL RemoveStr
POP EDX
POP ECX
INC EDX
LOOP @@loop
@@exit:
POP ESI
POP EBX
end;
And TBButtonsWidth in Form havent effect, tboTextBottom in option been ignored, seems these problems still exists in kol 2.48.
I'll try to fix it later.
Vladimir Kladov (2006-12-05 19:15:00) [3]certainly StrComp / WStrCmp should be there, I'll fix it.
azsd (2006-12-05 12:23:00) [4]er, I have remove tboFlat for debug and forget set it back now.
I have modified other codes in the function with same compare operations.
now it seems working fine.
I don't know why compare between pkolchar not works as except,
but I think there will some same issue in code now.
azsd (2006-12-05 11:48:00) [5]
if Buttons[ I ] = PKOLChar( '-' ) then
it Seems doing compare of two pointers address?
I modify it to "Buttons[I]^ = '-'" (or lstrcmp(uttons[ I ], PKOLChar( '-' ))) and it can "if" into "PAB.iBitmap := -1;" now.
mmmm, it now leave an blank there instead button but still not vert line stripe appearence.
I'll check prev kol source later to see if there some differents.