Ger Cannoll
|
|
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
|
|
|
Greg McGuffey
|
|
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
|
|
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
|
|
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
|
|
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
|
|
Group: StrataFrame Users
Posts: 430,
Visits: 507
|
|
|
|
Ivan George Borges
|
|
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
|
|
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.
|
|
|
Ivan George Borges
|
|
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
|
|
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
|
|
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
|
|
Group: StrataFrame MVPs
Posts: 1.9K,
Visits: 21K
|
Hi Gerard. Did I say resource file?! And by that you didn't understand Designer file?  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
|
|
Group: Forum Members
Posts: 2K,
Visits: 6.6K
|
I wondered what you were talking about....
|
|
|
Ivan George Borges
|
|
Group: StrataFrame MVPs
Posts: 1.9K,
Visits: 21K
|
On times like this just hit me on the head so I come back to normal...
|
|
|