mierlp Posted August 18, 2017 Share Posted August 18, 2017 Hi, On my form there a several datasources. The every datasource has a onStateChange with the following code to enable/disable buttons. This works like i want. procedure TFormTableProduction.dsProductionBasicDayStateChange( Sender: TObject); begin if dmProduction.ProductionBasicDay.State in [dsBrowse] then begin FormTableProductionDay.UniBitBtn_Add.Enabled := True; FormTableProductionDay.UniBitBtn_Delete.Enabled := True; FormTableProductionDay.UniBitBtn_Save.Enabled := False; FormTableProductionDay.UniBitBtn_Cancel.Enabled := False; end; if dmProduction.ProductionBasicDay.State in [dsInsert,dsEdit] then begin FormTableProductionDay.UniBitBtn_Add.Enabled := False; FormTableProductionDay.UniBitBtn_Delete.Enabled := False; FormTableProductionDay.UniBitBtn_Save.Enabled := True; FormTableProductionDay.UniBitBtn_Cancel.Enabled := True; end; end; Attached sample form. When the user hits the button with the (dutch) text 'Beheren productie dagen' then a second form will be opened for adding prodution days. Because the datasource for this table is also on the first form the buttons for addind/editing in this form are not responding to the state. In the windows variant of the application i use : if ( Assigned( FormTableProductionDay ) ) then begin ...my code end; But in uniGui thats not working...how can i solve this? Quote Link to comment Share on other sites More sharing options...
erich.wanker Posted August 21, 2017 Share Posted August 21, 2017 if i understand you correctly... i use a array - in this array i write every created form (and delete the ntry if i close the form) So - i know every open form - and can handle the 2 differnet situaltions (if its already open or if i must create it) HTH Erich // write form in array procedure ....UniFormCreate(Sender: TObject); begin mainform.fensteranzahl:=mainform.fensteranzahl+1; mainform.fensterliste[mainform.fensteranzahl]:=self.Name; // delete form in array procedure ...UniFormClose(Sender: TObject; var Action: TCloseAction); var x:Integer; y:Integer; begin // Aktuelles fenster aus der Fensterliste löschen y:=1; for x:=1 to mainform.fensteranzahl do begin if mainform.fensterliste[x]=self.Name then y:=y+1; mainform.fensterliste[x] := mainform.fensterliste[y]; y:=y+1; end; mainform.fensteranzahl:=mainform.fensteranzahl-1; end; Quote Link to comment Share on other sites More sharing options...
mierlp Posted August 21, 2017 Author Share Posted August 21, 2017 Hi Erich Nice solutions...where or what's best placeo to define thearray...on mainform, mainmodule, servermodule ? regards Peter Quote Link to comment Share on other sites More sharing options...
erich.wanker Posted August 22, 2017 Share Posted August 22, 2017 i use: mainform public fensterliste: Array[1..100] of String; fensteranzahl:Integer; Quote Link to comment Share on other sites More sharing options...
mierlp Posted August 22, 2017 Author Share Posted August 22, 2017 thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.