Amend column size on NominalGridLookup

SOLVED

Hi all,

I want to amend the grid inside a dropdown programmatically so the Name column is wide as soon at the form open.

But I am unable to get the grid inside it because its control is PopupTextBox+Dropdown which I cannot initiate in the code. Also the Dropdown class inside PopupTextBox is an internal class. 

Is there any way to do this?

Parents
  • +1
    verified answer

    Yeah.  The easiest way to deal with this is to just increase the width of the drop-down; the 'Name' column is set to auto-size so it will stretch to fill the increased width.

    Just get hold of the NominalGridLookup in the usual way and add a handler to PopupOpened:

    private void NominalGridLookup_PopupOpened(object sender, Sage.Common.Controls.PopupOpenedEventArgs args)
    {
        if(args.Form != null)
        {
            args.Form.Width = 700;               
        }
    }

     If you really want to manipulate the columns then you can get at the list inside the drop-down form like this:

     var list = args.Form.Controls[0] as Sage.ObjectStore.Controls.List;

    ..and then you can get at the Columns collection of the List.

Reply
  • +1
    verified answer

    Yeah.  The easiest way to deal with this is to just increase the width of the drop-down; the 'Name' column is set to auto-size so it will stretch to fill the increased width.

    Just get hold of the NominalGridLookup in the usual way and add a handler to PopupOpened:

    private void NominalGridLookup_PopupOpened(object sender, Sage.Common.Controls.PopupOpenedEventArgs args)
    {
        if(args.Form != null)
        {
            args.Form.Width = 700;               
        }
    }

     If you really want to manipulate the columns then you can get at the list inside the drop-down form like this:

     var list = args.Form.Controls[0] as Sage.ObjectStore.Controls.List;

    ..and then you can get at the Columns collection of the List.

Children