Generic Browse Dialog


Author
Message
Ger Cannoll
Ger Cannoll
Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)
Group: StrataFrame Users
Posts: 430, Visits: 507
I have been using the Browse Dailog on a few screens and its working out very well. Typically I use it with a text Box , say to do a look up on a cutomer file. The user would enter text into the text box, and I first do an exact lookup on the Customer table to see if the cutomer number exists. If it does, I don't call the Browse Dialog. If it does not, i assume the user has entered 'part' of the name and I call a browse dialog with a few colums ftom the customer file set up. All this is working perfectly.

Now I find  I need this funtionality on say 20 forms. What I had started to do was repeat the same text box and browse dialog on each form, but thought there must be a better way . Some guidance of setting up a Customer Lookup class (based on a text Box that calls the browse dialog) that I can then drop on each of my forms.I can manage searching the tables etc but not sure how to set up the BrowseDialog in code as opposed to from within a form.

Pseudo code of the sort of thing I'm lookin at would be:

public class Textbox : MicroFour.StrataFrame.UI.Windows.Forms.Textbox
{
private System.Drawing.Color originalBackgroudColour;
protected override void OnEnter(EventArgs e)
{
//-- Run Base Class Code
base.OnEnter(e);
protected override void OnLeave(EventArgs e)
{
//-- Run the Base Code for the textbox
base.OnLeave(e);
// Pseudo Code
SearcCustomer(this.tetBox)
If NotFound
{Call BrowseDialog}
}
} // End textBox

Replies
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Check that you set the FieldType correctly. This must match the type of defined in the BO for the field. Look in the BO designer file, in the shared/static constructor for the definition of the _FieldDbTypes values.  This is the line of code that likely is causing the issue:

SearchFieldItem1.FieldType = System.Data.DbType.AnsiString;

Likely the type is DbType.String.
Ger Cannoll
Ger Cannoll
Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)
Group: StrataFrame Users
Posts: 430, Visits: 507
I changed to DbType.String but it did not make any difference.

After some additinal testing, the only thing I noticed was that in my SearchFiledItem1,  I had called the Field Sma_Name whereas in the business object it was called SMA_NAME. I changed the SearchFiledItem1 to SMA_NAME and it fixed the problem. It obviously looks for an exact match and is case sensitive. Being used to VFP, Case Sensitivity was never an issue so I'l just have to be a bit more careful in future.

Anyway, I think I am where I wanted to be with this.... able to programatically create and call the BrowseDialog, albit for one field. I need to do some more paramerisation but many thanks again for your very detailed and 'patient' assistance
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
No problem.  I had forgot that dictionaries are by default case sensitive. Sorry I didn't catch that earlier and I'm glad you got it working.
Ger Cannoll
Ger Cannoll
Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)
Group: StrataFrame Users
Posts: 430, Visits: 507
I am having a problem setting a property of the Browse programatically. The default browse window that comes up for the conteants is too small and I want to make it biogger:

In design mode, I can change the height (or where the BottomPanel starts). i.e. where the reulsts are shown. This seems to be in a property called BottomPanelContents , but I dont know how to access this: e.g Heght or starting position

bd.FormLayout.BottomPanelContents ???


Ger Cannoll
Ger Cannoll
Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)
Group: StrataFrame Users
Posts: 430, Visits: 507
Any ideas on this ??
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi Gerard.

Have you tried dealing with the FormLayout property? Also, don't forget you can give your user the ability to make it any size and save the data to a Registry Key:


Ger Cannoll
Ger Cannoll
Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)
Group: StrataFrame Users
Posts: 430, Visits: 507
Yes I tried to use the FormLayout proerty but could not find a property like Size, or Position . For the formlayout.BottomPanel(or TopPanel) It hust seems to have Compare/Equals...Tostring. I have attached a screenshot.
Attachments
BrowseDialog.Formlayout.png (112 views, 144.00 KB)
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Have you tried having a look at a BD resource file (its .resx) and checking how the layout is set?
Ger Cannoll
Ger Cannoll
Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)
Group: StrataFrame Users
Posts: 430, Visits: 507
Where would I find the BD resource file  and what should I be looking for (Dont really know waht a resource file is)
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
When you adjust the form layout there are several things you can do:

- Decide where to put the three key elements of a BD: criteria, results and info panel. You have three places you can put them: top panel, bottom panel or side panel.
- You decide if the user can resize the BD. And you can set the size by simply resizing the formlayout dialog that opens.
- You can initially show the bottom panel or side panel.

I highly recommend that you make a little sample app so you can play around with the settings to see what they do and spark your imagination.  Remember you can look at the designer file to see how to programatically setup the BD.

As to resource files, they usually are under files they are associated with. They contains things like position of a component on the design surface (design time) and icons/images/other resources that are embedded directly in a file. They are an XML file and VS has a UI to manipulate them and/or does it automatically when you move a component on the design surface or set an image on a control and use a local resource.
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi Gerard.

Did I say resource file?! And by that you didn't understand Designer file? Hehe

Sorry about it, I meant the .Designer.vb file. Do you still have the LookUpControlSample I posted for you? You could use it to play around with as Greg mentioned. You can play with the FormLayout and have a look at the CustomersBrowseDialog.Designer.vb and check the properties that set widths, sizes and so on:

        '
        'CustomersBrowseDialog
        '
        BrowseColumnItem1.ColumnHeaderText = "First Name"
        BrowseColumnItem1.ColumnHeaderWidth = 200
        BrowseColumnItem1.ColumnTextAlignment = System.Windows.Forms.HorizontalAlignment.Left
        BrowseColumnItem1.DefaultSort = System.Windows.Forms.SortOrder.None
        BrowseColumnItem1.FormatString = "{0}"
        BrowseColumnItem1.PopulationType = MicroFour.StrataFrame.UI.ListViewColumnPopulationType.FormattedString
        BrowseColumnItem1.RegExPattern = ""
        BrowseColumnItem1.RegExReplacementValue = ""
        BrowseColumnItem2.ColumnHeaderText = "Last Name"
        BrowseColumnItem2.ColumnHeaderWidth = 200
        BrowseColumnItem2.ColumnTextAlignment = System.Windows.Forms.HorizontalAlignment.Left
        BrowseColumnItem2.DefaultSort = System.Windows.Forms.SortOrder.None
        BrowseColumnItem2.FormatString = "{1}"
        BrowseColumnItem2.PopulationType = MicroFour.StrataFrame.UI.ListViewColumnPopulationType.FormattedString
        BrowseColumnItem2.RegExPattern = ""
        BrowseColumnItem2.RegExReplacementValue = ""
        BrowseResultsPopulationSettings1.BrowseColumns.AddRange(New MicroFour.StrataFrame.UI.Windows.Forms.BrowseColumnItem() {BrowseColumnItem1, BrowseColumnItem2})
        BrowseResultsPopulationSettings1.DisplayFieldNames.AddRange(New String() {"cust_FirstName", "cust_LastName"})
        Me.BrowseResultsLayout = BrowseResultsPopulationSettings1
        Me.BusinessObjectType = "LookUpControlSample_BO.CustomersBO"
        BrowseDialogLayoutSettings1.AllowFormResize = True
        BrowseDialogLayoutSettings1.BottomPanelContents = MicroFour.StrataFrame.UI.BrowseDialogLayoutType.BrowseResults
        BrowseDialogLayoutSettings1.FormSize = New System.Drawing.Size(833, 636)
        BrowseDialogLayoutSettings1.LeftSplitterDistance = 153
        BrowseDialogLayoutSettings1.ShowBottomPanel = True
        BrowseDialogLayoutSettings1.ShowSidePanel = False
        BrowseDialogLayoutSettings1.SidePanelContents = MicroFour.StrataFrame.UI.BrowseDialogLayoutType.InformationPanel
        BrowseDialogLayoutSettings1.SideSplitterDistance = 450
        BrowseDialogLayoutSettings1.TopPanelContents = MicroFour.StrataFrame.UI.BrowseDialogLayoutType.SearchFields
        Me.FormLayout = BrowseDialogLayoutSettings1

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I wondered what you were talking about....  Blink
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
On times like this just hit me on the head so I come back to normal... BigGrin
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Ger Cannoll - 15 Years Ago
Edhy Rijo - 15 Years Ago
Ivan George Borges - 15 Years Ago
Ger Cannoll - 15 Years Ago
             You're welcome, Gerard. ;)
Ivan George Borges - 15 Years Ago
Ger Cannoll - 15 Years Ago
Ivan George Borges - 15 Years Ago
                         Hi Ivan. I will plough ahead then and see if I can develop a small...
Ger Cannoll - 15 Years Ago
                         I just took a look at the sample (nice Ivan) and then tried to...
Greg McGuffey - 15 Years Ago
                             Hi Greg. Many thanks for this and particulalrly taking the time to...
Ger Cannoll - 15 Years Ago
                                 My pleasure. Let me know if you need more clarification or if you come...
Greg McGuffey - 15 Years Ago
Ger Cannoll - 15 Years Ago
Greg McGuffey - 15 Years Ago
Ger Cannoll - 15 Years Ago
Greg McGuffey - 15 Years Ago
                         Hi Greg.. Did'nt realise there was so much in Reflection so I am...
Ger Cannoll - 15 Years Ago
                             Gerard,

This is actually a good way to start understanding...
Greg McGuffey - 15 Years Ago
                                 I have Kernel_BOLibrary referenced as I can access the Business...
Ger Cannoll - 15 Years Ago
                                     There has got to be some issue with references/bo names. In cases...
Greg McGuffey - 15 Years Ago
                                         Ok Greg.... will give that a try .
Ger Cannoll - 15 Years Ago
                                         Hi Greg. I took your advice and have set up two projects to come as...
Ger Cannoll - 15 Years Ago
                                             I'll take a look at this either later today or tomorrow.
Greg McGuffey - 15 Years Ago
                                                 Hi. just wondering if this has dropped off the radar ??
Ger Cannoll - 15 Years Ago
                                                     Ah...oops. I'll take a look at it today. Sorry for the delay.
Greg McGuffey - 15 Years Ago
                                                         You were really, really close. :D

You had done two things...
Greg McGuffey - 15 Years Ago
                                                             Thanks for that Greg. I feel I am making progress now. I am at the...
Ger Cannoll - 15 Years Ago
                                                                 Just wondering...any thoughts on this ??
Ger Cannoll - 15 Years Ago
                                                                     If you decide to go this route, and configure the BrowseDialog in code...
Greg McGuffey - 15 Years Ago
                                                                         I have changed the code now, and am getting the browse dialog screen...
Ger Cannoll - 15 Years Ago
                                                                             Check that you set the FieldType correctly. This must match the type...
Greg McGuffey - 15 Years Ago
                                                                                 I changed to DbType.String but it did not make any difference. After...
Ger Cannoll - 15 Years Ago
                                                                                     No problem. I had forgot that dictionaries are by default case...
Greg McGuffey - 15 Years Ago
                                                                                         I am having a problem setting aproperty of the Browse programatically....
Ger Cannoll - 15 Years Ago
                                                                                             Any ideas on this ??
Ger Cannoll - 15 Years Ago
                                                                                                 Hi Gerard. Have you tried dealing with the FormLayout property? Also,...
Ivan George Borges - 15 Years Ago
                                                                                                     Yes I tried to use the FormLayout proerty but could not find a...
Ger Cannoll - 15 Years Ago
                                                                                                         Have you tried having a look at a BD resource file (its .resx) and...
Ivan George Borges - 15 Years Ago
                                                                                                             Where would I find the BD resource file and what should I be looking...
Ger Cannoll - 15 Years Ago
                                                                                                                 When you adjust the form layout there are several things you can do:...
Greg McGuffey - 15 Years Ago
                                                                                                                     Hi Gerard. Did I say resource file?! And by that you didn't...
Ivan George Borges - 15 Years Ago
                                                                                                                         I wondered what you were talking about.... :blink:
Greg McGuffey - 15 Years Ago
                                                                                                                             On times like this just hit me on the head so I come back to normal......
Ivan George Borges - 15 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search