Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Prism Bind variables with components (https://www.delphipraxis.net/68447-bind-variables-components.html)

sk.Silvia 29. Apr 2006 18:58


Bind variables with components
 
hi there, lets say i have a checkbox and a boolean variable myvar, and i will that myvar=checkbox.checked

is there another way as to write

Delphi-Quellcode:
procedure TForm1.checkbox(Sender: TObject);
  begin
  myvar:=checkbox.checked;
  end;
like to bind the variable with the component, so each time i change the value of the component the value of a given variable will also be changed automaticly without any unnnecessary procedures and events...?

JasonDX 29. Apr 2006 19:14

Re: Bind variables with components
 
Since Checked is a property, accessed by private Methods, you cannot use (Method-)Pointers for that, but the RTTI might help you:
Delphi-Quellcode:
uses
  {...} TypInfo;
//...
  if GetPropValue(YourCheckbox, 'Checked') then
    ShowMessage('Checkbox is Checked');
Note: Although Delphi itself is not, the RTTI-Stuff in the .NET-Version of the VCL is case-sensitive ;)

greetz
Mike


Alle Zeitangaben in WEZ +1. Es ist jetzt 19:12 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