I neet to create a similar "Save As" GeneXus window

55 views Asked by At

Is it possible to share the c# code of GeneXus "Save as" window?

What I need is to represent the exact way to request the Module/Folder control.

GeneXus Save as

In my extension window I will request:

  • Name
  • Description
  • Module/Folder

It will be invoqued when the user select (with right click) a PXTools PXWorkWith pattern instance node and will suggest to create a PXTools PXQuery pattern instance getting the information from this original PXWorkWith node.

Thanks

1

There are 1 answers

2
Fede On

The Save as command of GeneXus is implemented using the Copy method of the Objects UI service. e.g.

KBObject original = ...
KBObject copied = UIServices.Objects.Copy(original);

The Copy method opens the dialog that prompts for a new name, and allows choosing where to save the object. If the user confirms saving the object, and there are no issues saving the copy, the saved copied instance is returned. Otherwise it returns null.

If you're interested in just using the dialog, and not the whole implementation, it can be invoked through the NewObjectDialog UI service. e.g.

KBObject original = ...
CreateObjectOptions options = new CreateObjectOptions
{
    Type = original.TypeDescriptor,
    Module = original.Module,
    Folder = original.Parent as Folder,
    OpenAfterwards = false,
    IgnoreBuilder = true,
    Name = original.Name + "Copy"
};
KBObject newObject = UIServices.NewObjectDialog.CreateObject(options);

If the user confirms the dialog, an unsaved empty instance is returned. Otherwise it returns null.

Hope that helps.