multimesut Posted February 19, 2018 Share Posted February 19, 2018 Merhaba, Yeni bir proje açıp sadece LoginForm ekliyorum. Aşağıdaki gibi basit bir kullanımda MainForm 2 kere create oluyor. Örnek için basit kod yaptım. Aslında login durumlarına göre yetkili formu create edip main içerisine basıyorum. "tKullanici.Parent:=Main.MainForm;". Değişkenlerine eriştiğim zaman create oluyor. Birde login form kapatırken create ediyor. Zaten Create edildi ise birdaha create edilmemesi lazım. Bir bug gibi geldi bana. Kullandığım sürüm "1.0.0.1420". Teşekkürler.. procedure TUniLoginForm1.btnLoginClick(Sender: TObject); begin main.MainForm.UniEdit1.Text:='Merhaba'; ModalResult:=mrOK; end; Link to comment Share on other sites More sharing options...
Sherzod Posted February 19, 2018 Share Posted February 19, 2018 Hi, You should use like in this demo example: \FMSoft\Framework\uniGUI\Demos\Desktop\LoginForm type TUniMainModule = class(TUniGUIMainModule) private { Private declarations } public { Public declarations } AUserName : string; end; procedure TUniLoginForm1.UniButton1Click(Sender: TObject); begin UniMainModule.AUserName := 'This User'; //<---------- ModalResult:=mrOK; end; procedure TMainForm.UniFormShow(Sender: TObject); begin UniLabel1.Caption := UniMainModule.AUserName; end; Link to comment Share on other sites More sharing options...
multimesut Posted February 19, 2018 Author Share Posted February 19, 2018 Thanks #Delphi Developer. But "Parent" Same Problem. tKullanici:=FrmKullanici.TKullaniciFrm.Create(UniApplication); tKullanici.Parent:=Main.MainForm; Link to comment Share on other sites More sharing options...
multimesut Posted February 19, 2018 Author Share Posted February 19, 2018 Çözümü aşağıdaki gibi buldum. Fix it; procedure TMainForm.UniFormShow(Sender: TObject); begin if TMainForm(Sender).Name<>'MainForm' then begin UniMainModule.UnRegisterFormInstance(TMainForm(Sender)); UniMainModule.RegisterFormInstance(MainForm); Hide; end; end; Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted February 23, 2018 Administrators Share Posted February 23, 2018 Merhaba, LoginForm'un içinden MainForm'a ulaşmaya asla çalışmayın. Sorunun kaynağı budur. Ortak verilerinizi MainModule'de saklayın. Link to comment Share on other sites More sharing options...
Abaksoft Posted February 25, 2018 Share Posted February 25, 2018 مرحبا http://forums.unigui.com/index.php?/topic/10086-opening-two-form-instances-when-referencing-it/&do=findComment&comment=52488 Best regards Link to comment Share on other sites More sharing options...
multimesut Posted February 26, 2018 Author Share Posted February 26, 2018 Tüm ortak verilerim MainModule de. Fakat UniGUI de tek bir MainForm Page olabildiği için diğer sayfalarımı MainForm a Parent kullanıyorum (tFirma.Parent:=Main.MainForm;). Hal böyle oluncada MAIN e dokunmak gerekiyor. Aslında UniGUI sadece tek bir MainForm Page olarak tasarlanmış, ikinci MainForm i create etmemesi gerek. 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