RegistryRepositoryKey saving the wrong SF_FormHeight value


Author
Message
Edhy Rijo
E
StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi,

I have a main MDI form and I have setup the following properties:

  • RegistryRepositoryKey = HKEY_CURRENT_USER\Software\Progytech\Card Tracking System\MainDialog
  • RememberFormLocation = True
  • RememberFormMaximizedState = True
  • RememberFormSize = True

Now when I open this form, it will update the registry as follow:

Without doing any change to the Main Form size, I close the application and run it again, then new values are being saved in the registry, causing the form to keep showing up with the wrong height value.

Notice that the SF_FormHeight and SF_FormY values are the one that changed without me resizing the form.  Now this form has an UltraToolbarsManager acting as a RibbonBar and an UltraStatusBar which I believe may be causing this effect, since I do have other projects using the same Main Form without the infragistics controls and does not show this behavior. 

I have the following code in the OnLoad method of the form:

Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)

     MyBase.OnLoad(e)

     Dim applicationTitle As String = "Card Tracking System"

     Me.Text = String.Format("{0} ({1})", applicationTitle, My.Application.Info.Version.ToString)

     '-- Set the MDI backcolor to white

     _MDIClient.BackColor = System.Drawing.Color.White

     '-- Add the MDI

     Me.Controls.Add(_MDIClient)

     '-- Create a handle to the CurrentUserChanged event to update the user information shown in main form.

     AddHandler MicroFour.StrataFrame.Security.SecurityBasics.CurrentUserChanged, AddressOf UpdateCurrentUserInfo

     Me.UpdateCurrentUserInfo()

     '-- Set the Connection label on the status bar

     Me.UltraStatusBar1.Panels("sbConnectedTo").Text = "Connected to: " & GetApplicationActiveConnectionStringTitle(ConnectionManager.ApplicationKey, "")

End Sub

This Main Form was created based on the Main Form in the StrataFlix sample, you can see the MainFormSample.png file attached for a reference.

Is there any recommendation to solve this situation?

Edhy Rijo

Attachments
SF_RegistryEditor1.png (173 views, 51.00 KB)
SF_RegistryEditor2.png (173 views, 52.00 KB)
Main Form Sample.png (187 views, 71.00 KB)
Replies
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
It is the OnFormClosing method within the BaseForm class in the Business assembly.  There is a method called SaveSizeAndLocation that gets called.
Edhy Rijo
E
StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Trent,

Thanks for the information.  I found the problem in the RestoreSizeAndLocation() method in this line of code:

'-- Set the size

If Me.RememberFormSize Then

     Me.Height = lnHeight

     Me.Width = lnWidth

End If

In this assignment Me.Height will not assume or accept the value in lnHeight, I would guess it has to do with the way the form is instantiated with the UltraToolbarsManager.  Here is what I did:

  • Override the RestoreSizeAndLocation() in my main form, of course I had to add the private Constant needed.
  • In my Onload, I added a call to Me.RestoreSizeAndLocation() which actually will be run twice and that seem to temporarily fix the problem.  Here is the code:
  •  

    Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)

         MyBase.OnLoad(e)

         Dim applicationTitle As String = "Card Tracking System"

         Me.Text = String.Format("{0} ({1})", applicationTitle, My.Application.Info.Version.ToString)

         '-- Set the MDI backcolor to white

         _MDIClient.BackColor = System.Drawing.Color.White

         '-- Add the MDI

         Me.Controls.Add(_MDIClient)

         '-- Create a handle to the CurrentUserChanged event to update the user information shown in main form.

         AddHandler MicroFour.StrataFrame.Security.SecurityBasics.CurrentUserChanged, AddressOf UpdateCurrentUserInfo

         Me.UpdateCurrentUserInfo()

         '-- Set the Connection label on the status bar

         Me.UltraStatusBar1.Panels("sbConnectedTo").Text = "Connected to: " & GetApplicationActiveConnectionStringTitle(ConnectionManager.ApplicationKey, "")

         '-- This code is used temporarily until a final solution is available for the main form honoring the

         ' registry saved size and location.

         Me.RestoreSizeAndLocation()

    End Sub

Probably you can suggest a better temporary approach that does not require to overwrite the RestoreSizeAndLocation().



Edhy Rijo

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Edhy Rijo - 16 Years Ago
Trent L. Taylor - 16 Years Ago
Edhy Rijo - 16 Years Ago
                 Thanks! :)
Trent L. Taylor - 16 Years Ago
Edhy Rijo - 16 Years Ago
                         A friendly reminder, just in case you guys have missed the sample...
Edhy Rijo - 16 Years Ago
                             We haven't forgotten about this and you were supposed to have been...
Trent L. Taylor - 16 Years Ago
                                 [quote][b]Trent L. Taylor (01/29/2009)[/b][hr]But we do not have the...
Edhy Rijo - 16 Years Ago
                                     It is the OnFormClosing method within the BaseForm class in the...
Trent L. Taylor - 16 Years Ago
                                         Hi Trent, Thanks for the information. I found the problem in the...
Edhy Rijo - 16 Years Ago
Dustin Taylor - 16 Years Ago
Edhy Rijo - 16 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search