Subclassing BrowseDialog


Author
Message
Michel Levy
Michel Levy
StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)
Group: StrataFrame Users
Posts: 193, Visits: 9K
Hi,

I've subclassed BrowseDialog (only for purpose of localization, because yours is so so uggly Sick Wink )

when launching, I get an error:

26/07/2008 16:18:54
L'index était hors limites. Il ne doit pas être négatif et doit être inférieur à la taille de la collection.
Nom du paramètre : index
   à System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   à System.ThrowHelper.ThrowArgumentOutOfRangeException()
   à MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialogwindow.SetGroupBoxDimensions()
   à MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialogwindow..ctor(BrowseDialog browse, Boolean PopulateOnShow)
   à MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialog.ShowDialog(Boolean PopulateOnShow, IWin32Window ResultsWindowOwner)
   à MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialog.ShowDialog(Boolean PopulateOnShow)
   à MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialog.ShowDialog()
   à MicroFour.StrataFrame.UI.Windows.Forms.MaintenanceFormToolStrip.cmdBrowse_Click(Object sender, EventArgs e)
   à System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   à System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
   à System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   à System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   à System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
   à System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
   à System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   à System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   à System.Windows.Forms.Control.WndProc(Message& m)
   à System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   à System.Windows.Forms.ToolStrip.WndProc(Message& m)
   à System.Windows.Forms.Control.ControlNativewindow.OnMessage(Message& m)
   à System.Windows.Forms.Control.ControlNativewindow.WndProc(Message& m)
   à System.Windows.Forms.Nativewindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

my localisation are:

        Me.ClearText = "Effacer le résultat"
        Me.DownText = "Descendre"
        Me.EnterSearchCriteraStatusText = "Saisissez vos critères de recherche et appuyez sur {0} pour commencer la recherch" & _
            "e"
        Me.ForceCaseInsensitive = True
        Me.HeaderDetailText = "Entrez les critères de recherche ci-dessous pour trouver les enregistrements dési" & _
            "rés."
        Me.HeaderImage = Global.MLControlesSF.My.Resources.Resources.Explorer32
        Me.HeaderTitle = "Que voulez-vous chercher?"
        Me.LedgerCardColor2 = System.Drawing.Color.Gainsboro
        Me.OKText = "&Valider"
        Me.ResultsHiddenOnLoad = True
        Me.ResultsStatusText = "{0} résultats ont été trouvés en {1} seconde(s)"
        Me.SaveText = "Valider"
        Me.SearchFieldDownTooltip = "Déplacer le champ de recherche sélectionné vers le bas"
        Me.SearchFieldResetTooltip = "Réinitialiser le choix et l'ordre des champs de recherche aux valeurs par défaut"
        Me.SearchFieldSaveTooltip = "Valide vos choix de champs et reprend la recherche"
        Me.SearchFieldUpTooltip = "Déplacer le champ de recherche sélectionné vers le haut"
        Me.SetFocusToResultsAfterSearch = True
        Me.UpText = "Monter"
        Me.ViewResultsAsLedgerCard = True

Sure I miss something in subclassing, but what? and where?

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
I am not sure what the French message is saying, but to subclass a BrowseDialog, do this:

  1. Right-click the project and click Add New Item
  2. Select a Component
  3. Give it the name and then click Save (or OK)
  4. Open up the designer of the new component and change the inheritance to a MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialog.

That will subclass the BrowseDialog for you and then everything will show up and be plumbed correctly.

In regards to the translations, why don't you just let me send you the French translations, you translate them the way you think they should be, send them back to me, and then I will update the framework.

Michel Levy
Michel Levy
StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)
Group: StrataFrame Users
Posts: 193, Visits: 9K
Trent,

I've done exactly what you say, for subclassing a browsedialog (as I have done for sublcasing other components without problems)

I tried to set the localised strings in the designer, -> error when I attempt to showdialog this browsedialog, I tried to set in the sub new, same error again, then I tried in the Initializecomponent, ad again the same error


Public Class MLSF_BrowseDialog
        Inherits MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialog 

Public Sub New()
MyBase.New()
' Cet appel est requis par le Concepteur Windows Form.
InitializeComponent()
' Ajoutez une initialisation quelconque après l'appel InitializeComponent().
End Sub

End Class

The french error messages says "Index out of range. Index must not be less than 0, and less than collection count" (not sure of my translation for count, it refers to the number of items of the collection)

Below are the french translations for BrowseDialog:

        Me.ClearText = "Effacer le résultat"
        Me.DownText = "Descendre"
        Me.EnterSearchCriteraStatusText = "Saisissez vos critères de recherche et appuyez sur {0} pour commencer la recherch" & _
            "e"
        Me.HeaderTitle = "Que voulez-vous chercher?"
        Me.OKText = "&Valider"
        Me.ResultsStatusText = "{0} résultats ont été trouvés en {1} seconde(s)"
        Me.SaveText = "Valider"
        Me.SearchFieldDownTooltip = "Déplacer le champ de recherche sélectionné vers le bas"
        Me.SearchFieldResetTooltip = "Réinitialiser le choix et l'ordre des champs de recherche aux valeurs par défaut"
        Me.SearchFieldSaveTooltip = "Valide vos choix de champs et reprend la recherche"
        Me.SearchFieldUpTooltip = "Déplacer le champ de recherche sélectionné vers le haut"
        Me.SetFocusToResultsAfterSearch = True
        Me.UpText = "Monter"

Next week, I'll send you all French translations that need to be corrected.

Michel Levy
Michel Levy
StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)
Group: StrataFrame Users
Posts: 193, Visits: 9K
Hi,

going on my tests, I've found that adding a SF original browsedialog by drag and drop from toolbox on a form generates that code in myform.Designer.vb:

Me.BrowseDialog1 = New MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialog(Me.components)
,
whereas dropping my own subclassed browsedialog generates :
Me.MlsF_BrowseDialog1 = New MLControlesSF.MLSF_BrowseDialog

Reading again your source code, I can see such a method new(byval container ...). So Iv'e added the same method in my own subclassed browsedialog.

Now, if I modify in myform.Designer.vb the line that create the BrowseDialog, adding me.components as a parameter), all run fine.

Is there any way to do that correctly (without writing in designer.vb)?

Michel Levy
Michel Levy
StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)
Group: StrataFrame Users
Posts: 193, Visits: 9K
No, not so fine... me.component is automaticaly added when drag and drop from the toolbox, but still the same error raised again now.

definitely I misunderstood something...

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
This is actually standard .NET in regards to the component.  If you will do as I mentioned in the previous post, I promise that it will work.  I have done this dozens of times in the last two weeks alone!  You are welcome to post a sample reproducing your problem.  That might make it easier to determine your issue versus going back and forth over the forum.  Thanks.
Michel Levy
Michel Levy
StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)
Group: StrataFrame Users
Posts: 193, Visits: 9K
Trent,

I have created a new subclased BrowseDialog, exactly as you mentionned (new component in my controls library project, and simply add the inherintance in the class definition, without modifying any property)

I compile that project, then I go in my app project, add this new browsedialog in the toolbox, add it to a form, configure this browsedialog, setting it as browsedialog in the toolstrip

and crash again when clicking on the browse button!

same error: what does " MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialogwindow.SetGroupBoxDimensions()" references to, in the error message?

I also notice that the properties set on that browsedialog (i.e BusinessObjectType, SearchFields, BrowseResultsLayout) are reset as empty after launching that form (even without showing the browsedialog itself).

Thank you for all your advices.

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Sounds like you need to get the latest version of SF.  This is already done.  You can get it here: http://forum.strataframe.net/FindPost18055.aspx .  In fact, I think that this was done back in 1.6.5, but I know for a fact that it is in 1.6.6 since this is what we are running at present.
Michel Levy
Michel Levy
StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)StrataFrame User (437 reputation)
Group: StrataFrame Users
Posts: 193, Visits: 9K
I've downloaded and installed the last version (from your link), and still have the same issue:

3 properties of the subclassed browsedialog don't stay as I set them - BusinessObjectType, SearchFields, and BrowseResultsLayout.

I set those properties as needed from within the properties sheet of the form, then I save my form, and when I open this form again, those 3 properties are reset with blank.

Of course, I notice the same missing properties in debugger when setting a breakpoint inth form.shown event

Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Michel,

Just to make sure, check out the version of the SF libraries, by clicking the StrataFrame menu ->Version, they all should be 1.6.5.3

Edhy Rijo

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search