AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Multimedia delphi TadvGlowbutton Click
Thema durchsuchen
Ansicht
Themen-Optionen

delphi TadvGlowbutton Click

Ein Thema von drama22 · begonnen am 18. Okt 2014 · letzter Beitrag vom 13. Nov 2014
Antwort Antwort
drama22

Registriert seit: 12. Jan 2013
88 Beiträge
 
#1

delphi TadvGlowbutton Click

  Alt 18. Okt 2014, 03:37
i am about to understand how to show a form on click and hide it on click on the same button again

here is how i show the form

Delphi-Quellcode:
procedure TMAIN.btnVolClick(Sender: TObject);
var
  Rect: TRect;
  volfrm : Tvolfrm;
begin
volfrm := Tvolfrm.Create(nil);
try
  GetWindowRect(btnVol.Handle, Rect);
  if not Assigned(volfrm) then
  begin
    volfrm:= Tvolfrm.CreateParented(0);
    volfrm.FormStyle := fsStayOnTop;
  end;

  volfrm.Left := Rect.Left;
  volfrm.top := Rect.Top - volfrm.Height;
finally
volfrm.Show;
end;
end;
how to hide the for again on click the same button
  Mit Zitat antworten Zitat
Real_Thunder

Registriert seit: 25. Apr 2006
197 Beiträge
 
#2

AW: delphi TadvGlowbutton Click

  Alt 12. Nov 2014, 18:18
There are a few ways to do so.

it depends on ..... do you just wanna Show and hide ? or do you want to create and destroy on button click =
  Mit Zitat antworten Zitat
Benutzerbild von DeddyH
DeddyH

Registriert seit: 17. Sep 2006
Ort: Barchfeld
27.540 Beiträge
 
Delphi 11 Alexandria
 
#3

AW: delphi TadvGlowbutton Click

  Alt 12. Nov 2014, 19:50
This is one of several ways (still quite dirty):
Delphi-Quellcode:
type
  TMAIN = class(TForm)
  private
    FOtherFormVisible: Boolean;
    FVolFrm: TVolFrm;
    procedure SetOtherFormVisible(Value: Boolean);
    function GetVolFrm: TVolFrm;
    property OtherFormVisible: Boolean read FOtherFormVisible write SetOtherFormVisible;
    property VolFrm: TVolFrm read GetVolFrm;
    ...
  end;
  
...

procedure TMAIN.SetOtherFormVisible(Value: Boolean);
begin
  FOtherFormVisible := Value;
  if FOtherFormVisible then
    (* Using the property, not the private field due to lazy initialization *)
    VolFrm.ProceedShowCode
  else
    VolFrm.ProceedHideCode;
end;

function TMAIN.GetVolFrm: TVolFrm;
begin
  if not Assigned(FVolFrm) then
    FVolFrm := TVolFrm.Create(nil);
  Result := FVolFrm;
end;

(* Click-Code left *)
procedure TMAIN.btnVolClick(Sender: TObject);
begin
  (* Accessing the property to call its Setter *)
  OtherFormVisible := not OtherFormVisible;
end;
Detlef
"Ich habe Angst vor dem Tag, an dem die Technologie unsere menschlichen Interaktionen übertrumpft. Die Welt wird eine Generation von Idioten bekommen." (Albert Einstein)
Dieser Tag ist längst gekommen
  Mit Zitat antworten Zitat
drama22

Registriert seit: 12. Jan 2013
88 Beiträge
 
#4

AW: delphi TadvGlowbutton Click

  Alt 13. Nov 2014, 00:28
Thanks thats helps alot
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 04:59 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz