StrataFrame Forum

Browser Dialog: Fill combobox based on parameter of another combo

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

By Edhy Rijo - 10/15/2007

Hi,

I have two combobox in a Browser Dialog "Customers" and "Building Address".  The records in the Building Address should be filtered by the selected Customer. 

I have done this for the maintenance form, but I have not find a way to have the combo filtered in the Browser Dialog (BD), and the events exposed to the BD does not allow me setup code to Requery the BuildingAddress BO.

By Edhy Rijo - 10/17/2007

Hi Ben, Trent,

Could you please tell me if this is possible to do?

Thanks!

By Trent L. Taylor - 10/19/2007

At present, not easily.  There is not a way for you to implicitly requery another combo within the browse.  This is probably a good enhancement request.  Sorry Ermm
By Edhy Rijo - 10/19/2007

Trent L. Taylor (10/19/2007)
This is probably a good enhancement request.  Sorry Ermm

Hi Trent,

Thanks for the response, even thought it is really sad for me.  Do I have to enter this in the enhancement request forum, or you will take care of it for me? Tongue

I do like the way you guys design the Browser Dialog, but more hooks and flexibility are needed in there in order to allow the developer to cover more custom request by the application.  So more events and access to the controls PEMs in the browser will enable this flexibility for us.

I would like to be able to do something like this:

Me.ServiceCallsBO1_BrowseDialog.SearchFields("FK_Customers").Value

Me.ServiceCallsBO1_BrowseDialog.SearchFields("FK_Customers").Requery()

By Trent L. Taylor - 10/22/2007

Yeah, I will add it to our future enhancement list to look at.  Thanks Smile
By Edhy Rijo - 9/24/2008

Hi Trent,

I though this functionality was added to the framework at some point, if so, how would I get access the value of a search field in the browser dialog?

By Edhy Rijo - 9/24/2008

Hi Trent,

I think I figured out by using the SearchValueChanged event.  Could you please check this out to see if it is correct?

Private Sub ServiceCallsBrowserDialog_SearchValueChanged(ByVal sender As System.Object, ByVal e As MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialogSearchValueChangedEventArgs) Handles MyBase.SearchValueChanged

     '-- When a customer is selected form the combobox, then requery the Building combobox.

     If e.SourceSearchField.Key.Equals("FK_Customers", StringComparison.OrdinalIgnoreCase) Then

          Dim comboListPopulationParam1 As Integer = 0

          '-- If the customer combobox has any selected record, then update the

          ' comboListPopulationParam1 with the Customer PK

          If CType(e.SourceControl, ComboBox).SelectedIndex > 0 Then

               '-- Resize the combo to properly show its information.

               e.AllVisibleSearchControls("FK_Buildings").Width = 300

               comboListPopulationParam1 = CType(e.SourceControl, ComboBox).SelectedValue

          End If

          '-- Requery the Building Address combobox.

          CType(e.AllVisibleSearchControls.Item("FK_Buildings"), ComboBox).Requery(comboListPopulationParam1, MicroFour.StrataFrame.Business.BusinessEditingState.Idle)

     End If

End Sub

Also, the Building Address ("FK_Buildings") field combobox is not sized properly, the field type is an Integer, but the size of the combo is not enough to show the data correctly, so I am using e.AllVisibleSearchControls("FK_Buildings").Width = 300  here to at least re-size the combo when the Customer record has been selected, but that is not the correct way.  Is there a way to set the size of any control in the Browser Dialog programmatically?

By Trent L. Taylor - 9/24/2008

Honestly without setting this up I can't give you a straight answer off of the top of my head in regards to the sizing.  The sizing of the controls is done when they are created , but they anchors are also set.  You this could be what you are fighting.  But without setting up a quick sample I don't remember (and I am answering forum posts from my wife's laptop).  I will try and look at this over the weekend or something. 

As for the SearchValueChanged, this is correct and where you will want to place your code...it has actualy been here since 1.6.5 I am pretty sure.

By Edhy Rijo - 9/24/2008

Trent L. Taylor (09/24/2008)
... and I am answering forum posts from my wife's laptop)

That is a great excuse. Tongue  Just kidding Hehe

I will try to setup a sample test with the SF sample database, there is not rush on this one, so it can wait.

As for the SearchValueChanged, this is correct and where you will want to place your code...it has actually been here since 1.6.5 I am pretty sure.

Thanks for the confirmation, I got confused trying to get the values, but it is working beautifully and a very powerful functionality.

By Jéssica Neves - 10/22/2010

Hello!
I have a table of documents.
Documento_ID
this table have a foreign key to the table people.
Documento_Pessoas_ID
 
so I'm using a browser dialog ..
 
how do I bring the name of the person that is in the document
 
I would have to use the property search fields, Comb - business object?



have any examples to show me?
By Ivan George Borges - 10/22/2010

Hi Jéssica.

You will basicaly use the Search Field "Combo - Business Object" tab and set the Combo Population.

On the Search Fields dialog, Edit the search field and set it to your foreign key:



Then, under Combo - Business Object, configure the List Population Settings to use the BO you want and its Fill Method to bring the rows you want the combobox populated with:



Also, have a look at the help file under : "Application Framework" / "UI Layer" /  "Controls" / "Browse Dialog" / "Working with the Browse Dialog" / "Setting the Search Fields".
By Jéssica Neves - 10/22/2010

thank.

 Ivan!!!
By Ivan George Borges - 10/22/2010

You're welcome. Cool