BrowseDialog Question


Author
Message
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi Sam. No problem, here we go:
  • Add a new Item to your project.
  • Choose the Component Class.
  • Name it as you wish, like _BaseBrowseDialog
  • After added, open the _BaseBrowseDialog.Designer
  • Right below the "Partial Class" definition line, change the Inherits to  "Inherits MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialog"
  • Close and save it.
  • Now just double-click the _BaseBrowseDialog from the Solution Explorer to open the designer.
  • Once there, open the Code View window for it and add the following code:
    ''' <summary>
    ''' Overrided so to be able to have a Base Browse Dialog
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Protected Overrides Function IsInheritedBrowseDialog() As Boolean
        '-- Establish locals
        Dim llReturn As Boolean = False

        '-- Determine if this is an inherited form
        If Me.GetType().IsSubclassOf(GetType(_BaseBrowseDialog)) Then
            '-- This is an inherited class
            llReturn = True
        End If

        '-- Return the value
        Return llReturn
    End Function


Follow this same process for the others, except that you will inherit from other components and you won't need to add the Overrides Function.

 


Sam Tenney
Sam Tenney
StrataFrame Novice (102 reputation)StrataFrame Novice (102 reputation)StrataFrame Novice (102 reputation)StrataFrame Novice (102 reputation)StrataFrame Novice (102 reputation)StrataFrame Novice (102 reputation)StrataFrame Novice (102 reputation)StrataFrame Novice (102 reputation)StrataFrame Novice (102 reputation)
Group: StrataFrame Users
Posts: 70, Visits: 3.5K
Hi Ivan,

I would really like to begin creating my own base class versions of SF classes as you suggested, but I do not know how to begin that process.  Remember I am a beginner.  I can see in your LookupControlSample solution that you created your own base class business object and also a base class browse dialog, but I do not know the specific steps required to subclass the SF classes.

Any help would be appreciated.

Sam Tenney
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi Sam.

I guess you could start building your Base BrowseDialog so you could create this solution in it and all inherited BD would benefit from it:

http://forum.strataframe.net/FindPost27794.aspx

Then, you could probably use the BrowseDialogClosed event and add some code like this:

    Private Sub _BaseBrowseDialog_BrowseDialogClosed(ByVal e As MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialogClosedEventArgs) Handles Me.BrowseDialogClosed
        '-- check if your search exceeded the limit
        If CType(Me.BusinessObjectToPopulate, MicroFour.StrataFrame.Business.BusinessLayer).Count >= Me.MaximumReturnedRecords Then
            '-- inform the user, try doing it the SF way and use a ShowMessageByKey from a Message & Localization project
            MessageBox.Show("Your message to the user")
        End If
    End Sub

Edited 13 Years Ago by Ivan George Borges
Sam Tenney
Sam Tenney
StrataFrame Novice (102 reputation)StrataFrame Novice (102 reputation)StrataFrame Novice (102 reputation)StrataFrame Novice (102 reputation)StrataFrame Novice (102 reputation)StrataFrame Novice (102 reputation)StrataFrame Novice (102 reputation)StrataFrame Novice (102 reputation)StrataFrame Novice (102 reputation)
Group: StrataFrame Users
Posts: 70, Visits: 3.5K
Hi Trent,

Like this thread from 2007, I also want to present users with a warning message if the search criteria entered into a browse dialog returns the maximum number of records (so that they will know that there may be more records than they can see).  I found this thread and looked at your solution but because this thread is over 4 years old and because I do not plan on using a BrowseInformationPanel, I do not know if this is still the best solution because I know a lot of improvements have been made in the browse dialog.  I am still a beginner and I would appreciate any suggestions of what to code to use and where to put that code.

Sam Tenney
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
All you have to do since you are using a BrowseInformationPanel is handle the RowChanged event.  This contains the reference to the populated business object and you can determine exactly how many records have been returned:

If e.BusinessObject.Count = 1000 Then
    '-- Place your code here
End If

Do you know why those properties don't work in derived versions of the BrowseDialog class? 

There is not an issue.  You can control this through standard .NET attributes that handle the serialization of the property.  You have to overwrite the SearchFields and determine how they will be persisted.  This just depends on how the class is subclassed and we did not do this on that sample.  This is just basic .NET functionality.  The reason this seems wrong is because you have to manage the property differently since it is a collection.  It must have the DesignerSerializationVisibility(Content) attribute applied when overwritten.

fparker
fparker
StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)
Group: Forum Members
Posts: 31, Visits: 199
What I am really trying to do is make it simple for us to display this warning in all of our applications without having to do any application specific coding.  I found that if I created a class derived from the BrowseDialogInformationPanel that I could use this class to sink the TextChanged event of the label in the BrowseDialogWindow's status bar.  From there I can determine the number of records returned and, if necessary, display a warning (either in the status bar or as a message box) - all that would be required when developing an application is the use of our derived panel rather than your standard panel.  The catch is that there is no way to get access to the MaximumReturnedRecords property of the BrowseDialog class.  I could add a MaximumReturnedRecords property to my derived panel but that would require application programmers to set this value in two places (on the panel and on the BrowseDialog object) and I know people would sometimes forget to set them both. 

So, what I was thinking was that I could go ahead and add the MaximumReturnedRecords property to my panel and also create a derived version of the BrowseDialog object that would set the MaximumReturnedRecords property of the panel to match its own value.  Then application programmers would have to use our version of the BrowseDialog and our panel but would get the warning for free.

I investigated the CRM sample you mentioned and found that the derived BrowseDialog that it contains suffers from the same problem as my test - changes made to the BrowseResultsLayout and SearchFields properties are not persisted.  I don't want to force application developers to fill these properties through code as the CRM sample does.

Do you know why those properties don't work in derived versions of the BrowseDialog class?  Thanks for your help. 

 Fran Parker

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
Well, you have several issue here.  First, you will not be able to inherit the actual form that presents the message.  This is not the BrowseDialog class, it is another class that is a dialog called from the  BrowseDialog class. 

Secondly, you can see an example of how to inherit a BrowseDialog in the Sample CRM Application.  It is currently only available on VB.NET but the next update will include this sample in C# as well.  But it should at least give you a starting point to see how to subclass a BrowseDialog.

As for presenting a message when the max records are returned, this would require an enhancement to the current browse dialog.

Are you wanting to show the message within a Browse Info Panel? 

fparker
fparker
StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)
Group: Forum Members
Posts: 31, Visits: 199
I'd like to present users of my application with a warning message if the search criteria entered into a browse dialog returns the maximum number of records (so that they will know that there may be more records than they can see).  The TextChanged event of the label in the status bar on the BrowseDialogWindow seems like a good place to do this check as it gets fired when the search ends.  I tried sinking this event from a class derived from the BrowseDialogInformationPanel class but the problem is that I can't determine what the maximum number of records allowed is.  There doesn't seem to be a way to get back to the BrowseDialog object on the calling form.  So, I created a new class derived from the BrowseDialog class.  I intended to have it pass the maximum number of allowed records on to the information panel.  But I seem to be having trouble inheriting from the BrowseDialog class.  As a test, I created a class defined as follows:

public class Class1 : MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialog

{

        public Class1()

           : base()

       {

       }

       public Class1(System.ComponentModel.IContainer Container)

            : base(Container)

      {

      }

}

It compiles without a problem and I can paint it onto a form but changes made to the BrowseResultsLayout and SearchFields properties are not persisted.  Of course, this makes it useless.  Do you guys have any idea what I am doing wrong? Or do you have any better suggestions for accomplishing the original goal?  Thanks for your help.

Fran Parker


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