Guest Posted November 4, 2010 Share Posted November 4, 2010 Message from: "Harry Rogers" Hi Farshad What's is the correct mechinism to access specific instances of forms within a session. Maybe a little diagram helps ?? Dynamic Dynamic Dynamic forms 1 forms 2 forms 3 2.1 1.1 /------- Link to comment Share on other sites More sharing options...
Guest Posted November 5, 2010 Author Share Posted November 5, 2010 Message from: "Farshad Mohajeri" "Harry Rogers"=20 > Hi Farshad >=20 > What's is the correct mechinism to access specific instances of forms > within a session. Maybe a little diagram helps ?? >=20 > Dynamic Dynamic Dynamic > forms 1 forms 2 forms 3 >=20 > 2.1 > 1.1 /------- > ------ 2.2 > \------- > 2.3 > / 1.2 /------- =20 > Mainform - ------ 2.4 > \ \------- 3.n > 2.5 \-------- > 1.3 /------- > ------ 2.6 > \-------=20 >=20 >=20 > if form 3.n needs to update a member in any other dynamic form how = does > it find the one it's after. Presuambly the session must have a forms > collection of some type ? how to access it ? >=20 > Hope (1) that makes snese > and (2) it's not a dumb question ! >=20 >=20 You can find forms by calling owner's "FindComponent".=20 Since "UniApplication" is owner of all forms below code should work: TargetForm:=3DUniApplication.FindComponent('MainForm'); or TargetForm:=3DUniApplication.FindComponent('UniForm1'); So are all these forms visible on the screen? I mean do you want to = change a visual control on another form? Please note that if "FreeOnDestroy" is true (true by default), Form will = be automatically destroyed when user closes it.=20 Link to comment Share on other sites More sharing options...
Guest Posted November 5, 2010 Author Share Posted November 5, 2010 Message from: "Farshad Mohajeri" "Please note that if "FreeOnDestroy" is true (true by default), Form = will be automatically destroyed when user closes it.=20 "FreeOnClose" Link to comment Share on other sites More sharing options...
Guest Posted November 5, 2010 Author Share Posted November 5, 2010 Message from: "Harry Rogers" Farshad Mohajeri wrote: > > "Please note that if "FreeOnDestroy" is true (true by default), > Form will be automatically destroyed when user closes it. > "FreeOnClose" Hi Farshad That's clear now - thank you -- . Link to comment Share on other sites More sharing options...
Guest Posted November 5, 2010 Author Share Posted November 5, 2010 Message from: "Harry Rogers" Harry Rogers wrote: > Farshad Mohajeri wrote: > > > > > "Please note that if "FreeOnDestroy" is true (true by default), > > Form will be automatically destroyed when user closes it. > > "FreeOnClose" > > Hi Farshad > > That's clear now - thank you Hi Farshad Uniapplication.FindComponent( aname ) is working for me in VCL mode but not webmode. In the web implementation I get an access violation if I try to write to anything on the 'found' form. All its components are nil in the debugwindow. // fine in vcl. AV in Webmode procedure TfrmCont1.btnAddTextClick(Sender: TObject); var afrm : TfrmMainMenu; begin afrm := TfrmMainMenu(uniapplication.FindComponent('frmMainMenu')); afrm.UniLabel1.Caption := 'HELLO'; end; All the best -- . Link to comment Share on other sites More sharing options...
Guest Posted November 5, 2010 Author Share Posted November 5, 2010 Message from: "Farshad Mohajeri" "Harry Rogers" wrote in message news:rUpWraPfLHA.2316@anaxagvs227... > Harry Rogers wrote: > >> Farshad Mohajeri wrote: >> >> > >> > "Please note that if "FreeOnDestroy" is true (true by default), >> > Form will be automatically destroyed when user closes it. >> > "FreeOnClose" >> >> Hi Farshad >> >> That's clear now - thank you > > Hi Farshad > > Uniapplication.FindComponent( aname ) is working for me in VCL mode but > not webmode. > > In the web implementation I get an access violation if I try to write > to anything on the 'found' form. All its components are nil in the > debugwindow. > > > // fine in vcl. AV in Webmode > > procedure TfrmCont1.btnAddTextClick(Sender: TObject); > var > afrm : TfrmMainMenu; > begin > afrm := TfrmMainMenu(uniapplication.FindComponent('frmMainMenu')); > afrm.UniLabel1.Caption := 'HELLO'; > end; > You are right. This should solve it: if WebMode then F:=TMainForm(TUniExtForm(UniApplication.FindComponent('MainForm')).FormObject) else F:=TMainForm(UniApplication.FindComponent('MainForm')); F.UniLabel1.Caption:='abc'; Well, as you can see it is not very straightforward. I've started a new branch and trying to redesign library core, so hopefully, such type confusions between VCL and WEB will no longer exist. . Link to comment Share on other sites More sharing options...
Guest Posted November 5, 2010 Author Share Posted November 5, 2010 Message from: "Harry Rogers" Farshad Mohajeri wrote: > > "Harry Rogers" wrote in message > news:rUpWraPfLHA.2316@anaxagvs227... > > Harry Rogers wrote: > > > > > Farshad Mohajeri wrote: > > > > > > > > >>> "Please note that if "FreeOnDestroy" is true (true by default), > >>> Form will be automatically destroyed when user closes it. > >>> "FreeOnClose" > > > > > > Hi Farshad > > > > >> That's clear now - thank you > > > > Hi Farshad > > > > Uniapplication.FindComponent( aname ) is working for me in VCL mode > > but not webmode. > > > > In the web implementation I get an access violation if I try to > > write to anything on the 'found' form. All its components are nil > > in the debugwindow. > > > > > > // fine in vcl. AV in Webmode > > > > procedure TfrmCont1.btnAddTextClick(Sender: TObject); > > var > > afrm : TfrmMainMenu; > > begin > > afrm := TfrmMainMenu(uniapplication.FindComponent('frmMainMenu')); > > afrm.UniLabel1.Caption := 'HELLO'; > > end; > > > > You are right. > > This should solve it: > > if WebMode then > > F:=TMainForm(TUniExtForm(UniApplication.FindComponent('MainForm')).For > mObject) else > F:=TMainForm(UniApplication.FindComponent('MainForm')); > > F.UniLabel1.Caption:='abc'; > > Well, as you can see it is not very straightforward. > > I've started a new branch and trying to redesign library core, so > hopefully, such type confusions between VCL and WEB will no longer > exist. Thanks for the quick solution - thought I was going mad ! -- . Link to comment Share on other sites More sharing options...
Guest Posted November 5, 2010 Author Share Posted November 5, 2010 Message from: "Harry Rogers" Farshad Mohajeri wrote: > TMainForm(TUniExtForm(UniApplication.FindComponent('MainForm')).FormOb > ject) - TuniExtForm is not a found type - am I missing some units ? -- . Link to comment Share on other sites More sharing options...
Guest Posted November 5, 2010 Author Share Posted November 5, 2010 Message from: "Harry Rogers" Harry Rogers wrote: > Farshad Mohajeri wrote: > > > TMainForm(TUniExtForm(UniApplication.FindComponent('MainForm')).Form > > Ob ject) > > > - TuniExtForm is not a found type - am I missing some units ? Found it in the dcus folder. -- . Link to comment Share on other sites More sharing options...
Guest Posted December 6, 2010 Author Share Posted December 6, 2010 Message from: "Junior/RO" Farshad Mohajeri escreveu: > This should solve it: > > if WebMode then > F:=TMainForm(TUniExtForm(UniApplication.FindComponent('MainForm')).FormObject) > else > F:=TMainForm(UniApplication.FindComponent('MainForm')); > > F.UniLabel1.Caption:='abc'; > > Well, as you can see it is not very straightforward. > > I've started a new branch and trying to redesign library core, so hopefully, such type confusions between VCL and WEB will no longer exist. You are talking about using interfaces? -- Que é essa vida se, com tanto a fazer, não temos tempo para parar e ver? . Link to comment Share on other sites More sharing options...
Guest Posted December 6, 2010 Author Share Posted December 6, 2010 Message from: "Farshad Mohajeri" "Junior/RO" wrote in message news:o7joIsQlLHA.2080@anaxagvs227... > Farshad Mohajeri escreveu: > >> This should solve it: >> >> if WebMode then >> >> F:=TMainForm(TUniExtForm(UniApplication.FindComponent('MainForm')).FormObject) >> else >> F:=TMainForm(UniApplication.FindComponent('MainForm')); >> >> F.UniLabel1.Caption:='abc'; >> >> Well, as you can see it is not very straightforward. >> >> I've started a new branch and trying to redesign library core, so >> hopefully, such type confusions between VCL and WEB will no longer exist. > > You are talking about using interfaces? > There will be interfaces too, but the core functionality will not be based on interfaces. . Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now