Page 2 of 2

Re: Limit Tabs / Forms

PostPosted: Fri Jan 17, 2020 9:10 am
by Mike.Sheen
SBarnes wrote:After Start message shows up and looking in Just Decompile in the form Factory BeforeFormStart is declared but never checked for being set and called


Logged as DEV-8008. I'll find you another way to cancel loading of a form and post back here.

Re: Limit Tabs / Forms  Topic is solved

PostPosted: Fri Jan 17, 2020 9:13 am
by SBarnes
You don't have to the following works in the after form start

Code: Select all
      if(JiwaForm.Manager.MDIParentForm.MdiChildren.Length > ApplicationManagerPlugin.FormLimit)
      {
         System.Windows.Forms.MessageBox.Show("You can't open more than " + ApplicationManagerPlugin.FormLimit.ToString() + " forms");
         JiwaForm.Form.Close();
         throw new JiwaFinancials.Jiwa.JiwaApplication.Exceptions.ClientCancelledException();
      }

Re: Limit Tabs / Forms

PostPosted: Fri Jan 17, 2020 9:17 am
by Mike.Sheen
SBarnes wrote:You don't have to the following works in the after form start

Code: Select all
      if(JiwaForm.Manager.MDIParentForm.MdiChildren.Length > ApplicationManagerPlugin.FormLimit)
      {
         System.Windows.Forms.MessageBox.Show("You can't open more than " + ApplicationManagerPlugin.FormLimit.ToString() + " forms");
         JiwaForm.Form.Close();
         throw new JiwaFinancials.Jiwa.JiwaApplication.Exceptions.ClientCancelledException();
      }


Ok, great - but still going to fix the issue where the BeforeFormStart event does not fire in the FormFactory, because that's what it was created explicitly for! Would also be more efficient to do that rather than cancel after loaded... and because it will be pretty confusing to the user if the form loads, a message box or something is displayed (often people have message boxes displayed when a record with certain data values is loaded), and then the form disappears.