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

vb.net - Alternative to the T-SQL AS keyword -

php - MySQLi binding parameters in a prepared statement doesn't work unless inserted after "WHERE" -

ios - CFRelease causing crash in iPad application -