ADempiere 361 Custom Forms

684 views
Skip to first unread message

Michael Gendrala

unread,
Nov 26, 2012, 6:28:47 AM11/26/12
to idem...@googlegroups.com
Hello Everyone,

I am currently trying to create a custom form in adempiere. The plan was to create a button in a window that will show a custom form, with parameters that came from the fields of the window (Kind of like the CreateFrom button of Material Receipt).

The question that I have is that is it possible to acquire the window number? or better, the grid tab of the current window being opened? I am currently trying to pass values from the window, but when I try to acquire values from the context, the values that are acquired based on window number are the ones from the custom form window, which is recognized as the present window, thus was only able to acquire null values. 

Thank you for the help.
Regards,
Michael Gendrala.

nilskm

unread,
Nov 27, 2012, 2:58:12 AM11/27/12
to idem...@googlegroups.com
I'm not sure I understand you perfectly. You want to open a custom form from a standard window? And you want to pass the current window no to the form? Or something similar? I try to give an answer the best I can.

You could simple create a standard button column and assign this button to a callout that opens this custom form of yours. The current window number is known in the callout and could be set for example to the environment or even to the form itself if you have component to set it to. If you want to receive the window number of the opened form. Well first of all you know it if you registered it in the directory. But if you didn't and the form inherited cpanel, then it has a getWindowNo method. I've created a callout that opens a custom form I've made to add products to a sales order. It passes the current window when opening (since my class inherits cdialog).

If I wanted the new window no and my class AddProduct would've inherited CPanel I could just get it by adding (after setVisible) "addP.getWindowNo();" . But this is just a dialog so it doesn't have its own window no.

This is the complete callout. I hope it helps.

    public String AddProduct(Properties ctx, int windowNo,
            GridTab mTab, GridField mField, Object value)
            throws AdempiereSystemError {       
       
        if (mTab.getRecord_ID() <= 0)
            return "";
        se.cyberphoto.form.AddProduct addP = new se.cyberphoto.form.AddProduct(Env.getWindow(windowNo), true);
        addP.setVisible(true);
        return "";
    }

Best regards

Nils

Michael Gendrala

unread,
Nov 27, 2012, 9:16:42 PM11/27/12
to idem...@googlegroups.com
Hello Nils,

I haven't thought about the possibility using callout to create a window. Yes, I want to pass the window number so that I can acquire the values of the context of that window, so that I can pass parameter values for the custom form. I will be trying this out, thank you for the detailed reply. 

Regards,
Michael.

Michael Gendrala

unread,
Nov 28, 2012, 4:18:53 AM11/28/12
to idem...@googlegroups.com
Hello Nils,

The help that you provided me, worked really well for what I needed. Thank you for the detailed reply. I will be taking note of this approach when I need to pass values from the standard window into custom forms.

Regards,
Michael G.
Reply all
Reply to author
Forward
0 new messages