How to use my created class in gui builder

45 views
Skip to first unread message

Armen Nalbandyan

unread,
Oct 9, 2013, 5:53:20 AM10/9/13
to codenameone...@googlegroups.com
I am overrided  Form  method  and wont in gui builder user my form.Can I do it?.Or I must create MyForm manually.
package com.codename1.ui;

/**
 *
 * @author ArmenNalbandyan
 */
public class MyForm extends Form{

    @Override
    void sizeChangedInternal(int w, int h) {
        Component component = getFocused();
        if(!(component instanceof  TextArea) || !(getWidth() == w && getHeight() != h)){
            super.sizeChangedInternal(w, h);
        }
    }

    
}

Shai Almog

unread,
Oct 9, 2013, 2:21:08 PM10/9/13
to codenameone...@googlegroups.com
What you are doing is unsupported, could and would break suddenly with no warning whatsoever.
You are relying on package protected functionality of a Codename One class, this is an implementation detail that might change.
I suggest you create a new question discussing why you chose to do this change in the first place. I'm assuming its a struggle with layout managers.

As to your question: You can subclass components in the GUI builder by overriding createComponent including for Form.

Armen Nalbandyan

unread,
Oct 11, 2013, 11:07:25 AM10/11/13
to codenameone...@googlegroups.com
I want to override  this , for https://code.google.com/p/codenameone/issues/detail?id=690&can=1&q=virtual%20keyboard this issue solution. 

Shai Almog

unread,
Oct 11, 2013, 3:45:28 PM10/11/13
to codenameone...@googlegroups.com
Serves me right contradicting an advice from Chen ;-)

You can use my suggestion to override createComponent.
Reply all
Reply to author
Forward
0 new messages