Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2003.02.10;
Скачать: CL | DM;

Вниз

TSpeedButton.visible не работает....   Найти похожие ветки 

 
xn0bys ©   (2003-01-30 14:39) [0]

Есть така промблема:
вот кусок...

type
TSmallDBNavigator = class(TCustomPanel)//class(TCustomPanel)
private
...
protected
{ Protected declarations }
Buttons : Array [0..8] of TSpeedButton;
...
end;

...
//Create
FPanel:=TPanel.Create(self);
...
For i:=8 downto 0 do
begin
Buttons[i]:=TSpeedButton.Create(FPanel);
Buttons[i].Parent:=FPanel;
Buttons[i].Caption:="";
Buttons[i].Flat:=True;
Buttons[i].Tag:=i;
Buttons[i].OnClick:=ButClick;
Buttons[i].Name:=TNames[i];
Buttons[i].Glyph.LoadFromResourceName(HInstance, UpperCase(TNames[i]));
Buttons[i].NumGlyphs:=2;
Buttons[i].Transparent:=False;
Buttons[i].Visible:=False;
end;
...
For k:=8 downto 0 do
begin
If CheckVisible(k) then
begin
Buttons[k].Visible:=True;
Buttons[k].Enabled:=CheckEnabled(k);
Buttons[k].Width:=FBWidth;
Buttons[k].Height:=FBHeight;
Buttons[k].Top:=border;
If Fpanel.BorderStyle=bsSingle
then Buttons[k].Left:=FPanel.Width-m*FBWidth-border-4
else Buttons[k].Left:=FPanel.Width-m*FBWidth-border;
inc(m);
end
else Buttons[k].Visible:=False;
end;
...
function TSmallDBNavigator.CheckEnabled(Value:Integer):Boolean;
begin
Case Value of
0: Result:=(bFirst in FEnabledButtons);
1: Result:=(bPrevious in FEnabledButtons);
2: Result:=(bNext in FEnabledButtons);
3: Result:=(bLast in FEnabledButtons);
4: Result:=(bInsert in FEnabledButtons);
5: Result:=(bDelete in FEnabledButtons);
6: Result:=(bEdit in FEnabledButtons);
7: Result:=(bPost in FEnabledButtons);
8: Result:=(bCancel in FEnabledButtons);
else Result:=False;
end;
end;

function TSmallDBNavigator.CheckVisible(Value:Integer):Boolean;
begin
Case Value of
0: Result:=(bFirst in FVisibleButtons);
1: Result:=(bPrevious in FVisibleButtons);
2: Result:=(bNext in FVisibleButtons);
3: Result:=(bLast in FVisibleButtons);
4: Result:=(bInsert in FVisibleButtons);
5: Result:=(bDelete in FVisibleButtons);
6: Result:=(bEdit in FVisibleButtons);
7: Result:=(bPost in FVisibleButtons);
8: Result:=(bCancel in FVisibleButtons);
else Result:=False;
end;
end;

Проблема вот в чём: В DesignTime почему-то свойство Buttons[i].Visible не действуте, т.е. кнопки всё равно видны, в РунТайме всё нормально.
Что тут может быть?


 
Романов Р.В. ©   (2003-01-30 14:43) [1]

Потому что так они сделаны.


 
xn0bys ©   (2003-01-30 14:49) [2]


> Романов Р.В. © (30.01.03 14:43)
> Потому что так они сделаны.

Что это значит?


 
xn0bys ©   (2003-01-30 14:53) [3]

jack128

procedure TSmallDBNavigator.SetVisibleButtons(Value : TButtonSet);
begin
If Value<>FVisibleButtons then
begin
FVisibleButtons:=Value;
Invalidate;
//Repaint;
// AutoPosition;
end;
end;

Procedure TSmallDBNavigator.Paint;
begin
Inherited Paint;
AutoPosition;
end;

Кусок

For k:=8 downto 0 do
begin
If CheckVisible(k) then
...

расположен в AutoPosition;



 
ZeroDivide ©   (2003-01-30 14:55) [4]

to [xn0bys]
Ну.. ты кода выкинул.
Интересно зачем это тебе в DesignTime ?
Вообще я такого никогда не пробовал. Но думаю надо у этих буттонов перекрыть Paint так

MyButton.Paint;
begin
if not (csDesignTime in ComponentState) then
inherited;
end;

Мм.. Интересно.. Получится расскажешь :)


 
ZeroDivide ©   (2003-01-30 14:56) [5]

Пока читал и разбирался... уже понаписали :)


 
Романов Р.В. ©   (2003-01-30 15:01) [6]

procedure TControl.CMVisibleChanged(var Message: TMessage);
begin
if not ( csDesigning in ComponentState) or
( csNoDesignVisible in ControlStyle) then
InvalidateControl(True, FVisible and (csOpaque in ControlStyle));
end;



Страницы: 1 вся ветка

Текущий архив: 2003.02.10;
Скачать: CL | DM;

Наверх




Память: 0.48 MB
Время: 0.017 c
6-28971
abcd
2002-12-19 14:15
2003.02.10
Socket ы


14-29023
Думкин
2003-01-18 08:40
2003.02.10
Ирак


8-28939
NailMan
2002-09-26 05:06
2003.02.10
Узнать информацию о видео-файле


3-28649
ruslanyd
2003-01-23 00:01
2003.02.10
Генераторы в Interbase


1-28880
AlexT1000
2003-01-30 16:08
2003.02.10
как пользоваться функцией HTMLHELP из под Delphi?