Jump to content

Accessibility of the controls


Recommended Posts

When adding controls to a form on the IDE in the Design tab, they're created with private accessibility. They're not acessible from a derived class. How can I change their accessibility?

 

Context: I am developing an application with about 15 pages that have exactly the same template: a top menu, a main panel, a status bar, etc... I was planning to create a template class with all the common controls and then, a derived form for each page of my application. Is there another way to achieve this?

Link to post
Share on other sites
  • Administrators

Currently, you can move {$I 'Form1:intf'} from the 'private' section to, say, 'protected' section by hand.

 

 
type 
  TForm1 = class(TW3Form) 
  private 
  protected 
    {$I 'Form1:intf'} 
    procedure InitializeForm; override; 
    procedure InitializeObject; override; 
    procedure Resize; override; 
  end; 

 

Alternatively, you can write properties that access controls, like this:

 

 
type 
  TForm1 = class(TW3Form) 
  private 
    {$I 'Form1:intf'} 
  public 
    property MyEdit: TW3EditBox read W3EditBox1; 
  end; 

 

Or you can just expose some property of a control:

 

 
type 
  TForm1 = class(TW3Form) 
  private 
    {$I 'Form1:intf'} 
  public 
    property MyEditText: string read (W3EditBox1.Text)  
                                write (W3EditBox1.Text); 
  end; 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...