Hyperlink Button Persist.

34 views
Skip to first unread message

Muchey

unread,
Jun 21, 2019, 12:51:19 PM6/21/19
to CodenameOne Discussions
Using this for a button sets the button's format to look like a hyperlink.

submit.getSelectedStyle().setTextDecoration(Style.TEXT_DECORATION_UNDERLINE);

Problem now is deleting this line off does not return button to its normal format.

ALL BUTTONS on the form now takes the hyperlink look! Without the presence of this line in any of the classes, like it was cached.

Setting to this does nothing.

submit.getSelectedStyle().setTextDecoration(Style.TEXT_DECORATION_NONE);

Steve Hannah

unread,
Jun 21, 2019, 6:16:49 PM6/21/19
to codenameone...@googlegroups.com
Can you share a more complete snippet or test case? 

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discu...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/558c8110-3a5e-432a-b229-89c6c87fe49d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Steve Hannah
Software Developer
Codename One

Muchey

unread,
Jun 24, 2019, 9:18:13 AM6/24/19
to CodenameOne Discussions
This code snippet was done for Button: Submit, Clear and Add, initially.

Button submit=new Button("Submit");
submit.getSelectedStyle().setTextDecoration(Style.TEXT_DECORATION_UNDERLINE);

Buttons looked like the one in the attached screenshot.

Now that line was deleted to this below
However, buttons still looked like this shown in screenshot, even after revalidate, and rebuild was done.

Button submit=new Button("Submit");
submit.getSelectedStyle().setTextDecoration(Style.TEXT_DECORATION_NONE);

2019-06-24 14_14_22-.png

Steve Hannah

unread,
Jun 24, 2019, 9:42:04 AM6/24/19
to codenameone...@googlegroups.com
Probably you want to use getStyle() or getAllStyles() instead of getSelectedStyle().  

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discu...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.

For more options, visit https://groups.google.com/d/optout.

Muchey

unread,
Jun 25, 2019, 1:22:49 PM6/25/19
to CodenameOne Discussions
Replaced with both methods, same behavior.
Removed line totally and still same behaviour as screenshot shared.


On Monday, June 24, 2019 at 2:42:04 PM UTC+1, Steve Hannah wrote:
Probably you want to use getStyle() or getAllStyles() instead of getSelectedStyle().  

On Mon, Jun 24, 2019 at 6:18 AM Muchey <amucheala...@gmail.com> wrote:
This code snippet was done for Button: Submit, Clear and Add, initially.

Button submit=new Button("Submit");
submit.getSelectedStyle().setTextDecoration(Style.TEXT_DECORATION_UNDERLINE);

Buttons looked like the one in the attached screenshot.

Now that line was deleted to this below
However, buttons still looked like this shown in screenshot, even after revalidate, and rebuild was done.

Button submit=new Button("Submit");
submit.getSelectedStyle().setTextDecoration(Style.TEXT_DECORATION_NONE);

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discussions+unsub...@googlegroups.com.

Shai Almog

unread,
Jun 25, 2019, 10:46:43 PM6/25/19
to CodenameOne Discussions
Do you do something like setUIID or setStyle afterwards?
It would wipe changes to the Style object.

Muchey

unread,
Jun 27, 2019, 3:17:59 PM6/27/19
to CodenameOne Discussions
I did this below, and button looked like a label which is expected.
However, I need this returned to default. 
changing UID to button, doesnt work and setSTyle() is not having an effect on it.

  submit=new Button("Submit");
        submit.setUIID("Label");
        Container placeButtons=new Container(new GridLayout(1,3));
        placeButtons.addComponent(submit);
        
        submit.addActionListener((e) ->{
            getInvoice();
        });

Shai Almog

unread,
Jun 27, 2019, 11:35:20 PM6/27/19
to CodenameOne Discussions
setUIID("Button") should restore the defaults.
Reply all
Reply to author
Forward
0 new messages