delphi - Form as instance variable -


in need form knows another, dispatch behavior. in past, need this, , solves using properties. now, same procedure, didnt works.

i have next uml diagram class, sorry, name class confuse: enter image description here

so, need thaht enpviewgeneric knows enpview. , children inherit knowledge.

im try in enpviewgeneric:

unit enpviewgeneric; [...] protected    { protected declarations }    fenpform: tenp; public     { public declarations }     property enpform: tenp read fenpform write fenpform; [...] 

the enpviewaddafter instanciation performed within enpview instance:

procedure tenp.optaddlastofclick(sender: tobject); var   afterform: tenpaddafter; begin   afterform := tenpaddafter.create(self);   afterform.enpform := self;   afterform.showmodal(); end; 

now, enpviewaddafter instance, needs querying enpview instance. so, defined public method in enpview query. method is:

function getselectedrowvalues(): tstringlist; 

so, code, fails access violation in fisrt line:

procedure tenpaddafter.formcreate(sender: tobject); var   row: tstringlist;   nromuestranvo: integer; begin   row := enpform.getselectedrowvalues();   nromuestranvo := strtoint(row[0]) + 1;   muestra.text := inttostr(nromuestranvo); end; 

any ideas ?.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -