StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      


12»»

Subclassing BrowseDialogExpand / Collapse
Author
Message
Posted 07/26/2008 9:54:05 AM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: Yesterday @ 7:10:24 AM
Posts: 65, Visits: 1,085
Hi,

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

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?

Post #18093
Posted 07/26/2008 8:31:02 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 7:08:30 PM
Posts: 4,811, Visits: 4,781
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.

Post #18101
Posted 07/27/2008 5:31:28 AM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: Yesterday @ 7:10:24 AM
Posts: 65, Visits: 1,085
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.

Post #18106
Posted 07/28/2008 7:40:02 AM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: Yesterday @ 7:10:24 AM
Posts: 65, Visits: 1,085
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)?

Post #18113
Posted 07/28/2008 8:27:49 AM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: Yesterday @ 7:10:24 AM
Posts: 65, Visits: 1,085
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...

Post #18114
Posted 07/28/2008 2:16:33 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 7:08:30 PM
Posts: 4,811, Visits: 4,781
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.
Post #18130
Posted 07/28/2008 3:21:21 PM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: StrataFrame Users
Last Login: Yesterday @ 7:10:24 AM
Posts: 65, Visits: 1,085
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.

Post #18137
Posted 07/28/2008 3:53:20 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 7:08:30 PM
Posts: 4,811, Visits: 4,781
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.
Post #18144