Subclassing BrowseDialog


Author
Message
Michel Levy
Michel Levy
Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 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
Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 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.

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
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
Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 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?

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