Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.pascal.delphi.misc > #281

Re: Change appearance

From "Stark" <franco.jommi@tin.it>
Newsgroups comp.lang.pascal.delphi.misc
References <4f9d4582$0$1386$4fafbaef@reader1.news.tin.it> <fd178ee0-d72e-421a-acbd-9343ec459c53@v22g2000yqm.googlegroups.com> <9d048cb6-9aa1-4215-8c93-4faad30fcae9@c30g2000vby.googlegroups.com> <4fa574fb$0$1387$4fafbaef@reader1.news.tin.it> <ecd19173-8388-4b33-8388-fbfddcdc4c6f@l15g2000vbv.googlegroups.com>
Subject Re: Change appearance
Date 2012-05-08 16:13 +0200
Message-ID <4fa937de$0$1375$4fafbaef@reader1.news.tin.it> (permalink)
Organization TIN.IT (http://www.tin.it)

Show all headers | View raw


In the attempt of using a TPanel, I tried just replacing it in my code to 
the TBevel but it doesn't work; when moving the mouse over he button, it 
starts flashing (you can only see a flickering border). Clicking the mouse 
on it (without releasing it) reveals the panel but not the button and 
finally releasing the mouse button it shows the button again. Can you 
understand why ?
In the meantime I tried your solution and it works. Anyway, here is my code 
:

procedure TForm1.FormShow(Sender: TObject);

var
  aButton: TButton;
  aPanel: TPanel;
  i: integer;
begin
  for i := 0 to 10 do
  begin
   aPanel := TPanel.Create(Self);
   aButton := TButton.Create(aPanel);
   with aButton do
   begin
       Name := Format('Button%d', [i]);
       Parent := Self;
       Left := 16;
       aButton.Top := 40 + i*25;
       Width := 145;
       Height := 20;
       Font.Style := Font.Style+[fsBold];
       OnClick := AnyButtonClick;
       OnMouseEnter := AnyBtnMouseEnter;
       OnMouseLeave := AnyBtnMouseLeave;
     end;
     with aPanel do
        begin
          Name := Format('Panel%d', [i]);
          Parent := Self;
          Left := aButton.Left-2;
          Top := aButton.Top-2;
          Width := aButton.Width+4;
          Height := aButton.Height+4;
          BevelWidth := 4;
          BorderStyle := bsSingle;
          visible:= false;
        end;
     end;
  end;
end;
end;

procedure Tform1.AnyBtnMouseEnter(Sender: TObject);
begin
If Sender is TButton then
   TPanel(TButton(Sender).Owner).Visible := true;
end;

procedure Tform1.AnyBtnMouseLeave(Sender: TObject);
begin
  If Sender is TButton then
    TPanel(TButton(Sender).Owner).Visible := false;
end;

Back to comp.lang.pascal.delphi.misc | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Change appearance "Stark" <franco.jommi@tin.it> - 2012-04-29 15:43 +0200
  Re: Change appearance "Ph. B." <philippe_NO_SPAM_.boucault@voila.fr> - 2012-04-30 11:04 +0200
  Re: Change appearance "alanglloyd@aol.com" <alanglloyd@aol.com> - 2012-05-02 14:29 -0700
  Re: Change appearance "alanglloyd@aol.com" <alanglloyd@aol.com> - 2012-05-02 23:59 -0700
    Re: Change appearance "alanglloyd@aol.com" <alanglloyd@aol.com> - 2012-05-03 00:03 -0700
      Re: Change appearance "Stark" <franco.jommi@tin.it> - 2012-05-05 20:44 +0200
        Re: Change appearance "alanglloyd@aol.com" <alanglloyd@aol.com> - 2012-05-06 23:17 -0700
          Re: Change appearance "Stark" <franco.jommi@tin.it> - 2012-05-08 16:13 +0200
          Re: Change appearance "Stark" <franco.jommi@tin.it> - 2012-05-09 19:40 +0200
            Re: Change appearance "alanglloyd@aol.com" <alanglloyd@aol.com> - 2012-05-09 11:22 -0700

csiph-web