Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
|
No problem...Glad to help!
|
|
|
Edhy Rijo
|
|
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
|
Trent L. Taylor (08/10/2009) Edhy, keep this one thing in mind and it should make things easier...these are just properties, classes, and collections. 100% of the control can be dynamically set and rebuilt to your liking. This is the same thing that is done via the type editors, but in your case, you would just be doing this manually.Thanks again, Trent. Wow, this is just great to have such control over the BD and opens up a whole new ideas on how to build my applications, very cool things can be done with the BrowseDialog control. Thanks a lot for the sample code.
Edhy Rijo
|
|
|
Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
|
Edhy, Keep this one thing in mind and it should make things easier...these are just properties, classes, and collections. 100% of the control can be dynamically set and rebuilt to your liking. This is the same thing that is done via the type editors, but in your case, you would just be doing this manually.
1.- When controlling the SearchFields like this, the layout will not be properly fit, so an space will be left between the SearchFields and the ListView, is there a way to control that too? see attached image.
Yup...just set the FormLayout property to whatever you like in code: Me.FormLayout.LeftSplitterDistance = 100 This is the property that you will set in the example that you gave. Even though it is called LeftSplitterDistance, it is used for the Top and Bottom as well.
2.- As for the BrowseResultLayout, could you provide a quick sample code of how to remove one columns from the listview?
Me.BrowseResultsLayout.BrowseColumns.Clear()
Me.BrowseResultsLayout.DisplayFieldNames.Clear()
Me.BrowseResultsLayout.DisplayFieldNames.Add("cust_Company")
Dim bc As New MicroFour.StrataFrame.UI.Windows.Forms.BrowseColumnItem()
bc.ColumnHeaderText = "Company"
bc.ColumnHeaderWidth = 200
bc.ColumnTextAlignment = Windows.Forms.HorizontalAlignment.Left
bc.FormatString = "{0}"
Me.BrowseResultsLayout.BrowseColumns.Add(bc)
|
|
|
Edhy Rijo
|
|
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
|
Thanks a lot Trent, that is exactly the type of control I want to have for my BDs. I have 2 more issues, if you don't mind 1.- When controlling the SearchFields like this, the layout will not be properly fit, so an space will be left between the SearchFields and the ListView, is there a way to control that too? see attached image. 2.- As for the BrowseResultLayout, could you provide a quick sample code of how to remove one columns from the listview?
Edhy Rijo
|
|
|
Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
|
Ok, you can take several routes on this, but here is my suggestion and the easiest route. Since you are in control of the dialogs and know what you need, you can override the OnInitializeSearchFields method, for example, and dynamically build your search list. So using the sample that you gave, if I only wanted the company field as a search field in the BrowseDialogFormnamesOnly class, then I would do this: Protected Overrides Sub OnInitializeSearchFields(ByVal e As System.EventArgs)
Me.SearchFields.Clear()
'-- Build the desired search fields list
Dim item As New MicroFour.StrataFrame.UI.Windows.Forms.SearchFieldItem()
item.FieldName = "cust_Company"
item.AllowAdvanced = True
item.DefaultSearchStyle = MicroFour.StrataFrame.UI.BrowseDialogAllSearchTypes.BeginsWith
item.FieldLabelText = "Company:"
item.FieldName = "cust_Company"
item.FieldType = Data.DbType.AnsiString
item.InitiallyEnabled = True
item.Key = "cust_Company"
item.Visible = True
Me.SearchFields.Add(item)
MyBase.OnInitializeSearchFields(e)
End Sub Obviously you can clean this up and add a method to generate this list, etc. But this is a quick and dirty way to get this working the way that you like. You can take a similar approach for the browse results layout.
|
|
|
Edhy Rijo
|
|
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
|
Hi Trent, Attached please find the requested Sample. It is a very easy sample and follows the StrataFlix sample for the BDs.
In the BrowseDialogClassSample.UI project I created a BaseBrowseDialog.vb class and setup the SearchFields and BrowseResultsLayout properties to use all possible fields I will use in the next 2 inherited classes:
- BrowseDialogForNamesOnly.vb: This class should show the following fields:
- SearchFields: cust_Company, cust_FirstName, cust_LastName
- BrowseResultsLayout: cust_Company, cust_FirstName, cust_LastName
- BrowseDialogForPhonesOnly.vb
- SearchFields: cust_PhoneDay, cust_PhoneNight
- BrowseResultsLayout: cust_FirstName, cust_LastName, cust_PhoneDay, cust_PhoneNight
The whole idea is to have a base class BD and then use it in several form with different searchfields and BrowseResultLayout columns.
I hope you can make the changes to this sample and re-post it so we can see how this should be accomplish. Thanks!
Edhy Rijo
|
|
|
Edhy Rijo
|
|
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
|
Hi Trent, I am setting up a simple sample that will show this scenario, please stay tune!!!
Edhy Rijo
|
|
|
Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
|
Is there a way to overcome this, other than have a BD for each form? Yes. I never have a single BD per form and create classes for all my BD. Maybe a sample showing the issue you are fighting would help so I can see what you are doing.
|
|
|
Edhy Rijo
|
|
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
|
Trent L. Taylor (08/04/2009) In fact, you may want to create your own search fields and browse results property on the base class and then after the load, you will set the SF properties.In the base BD class I have all fields I will use in all forms, then in my form in the BD.InitializeSearchFields() I have some code to set SearchFields("PONumber").Visible = False, and in fact this will now show that field, but will leave the dialog with an empty space in the groupbox of the search fields, so the group box will not resize automatically. Is there a way to overcome this, other than have a BD for each form?
Edhy Rijo
|
|
|
Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
|
Yeah, in this case you may have to override these properties and then re-expose the underlying property. In fact, you may want to create your own search fields and browse results property on the base class and then after the load, you will set the SF properties. This will allow the base class to initialize then in essense you will be clearing out and resetting the base properties.
|
|
|