1

Since the type property for picker objects are not exposed in the GUI Builder, what's the proper way to set the type via code for a picker object placed using the GUI Builder?

I've tried doing so in various form event methods (primarily initVars, onCreateMain and beforeMain), with no luck. this.findPicker() returns null in those situations (this is not unique to picker, this.findAnything fails in those same methods).

Jay
  • 55
  • 6

1 Answers1

1

I would suggest migrating to the new GUI builder. It seems the bug is there too and you should file that bug against it.

Regardless for both GUI builders you can just invoke setType() in the constructor right after the init call as a workaround or in the beforeForm event for the old GUI builder.

Shai Almog
  • 51,749
  • 5
  • 35
  • 65
  • Using the new GUI builder, the Picker component gets declared as a Button. I have to change that manually in the generated code to spinner.Picker to get access to the setType method. Is this also an issue? Or should I be able to get a date picker without modifying the generated code? – Jay Nov 01 '16 at 14:32
  • A simple test shows that modifying the generated code is a bad idea, since any future modifications through the GUI builder write over that change. There doesn't seem to be any way to call setType on the Button picker object that's generated by the new GUI builder. – Jay Nov 01 '16 at 14:38
  • I think you need to file an issue on that, Chen resolved a lot of GUI builder issues in the past couple of weeks: https://github.com/codenameone/CodenameOne/issues?utf8=%E2%9C%93&q=is%3Aissue%20guibuilder%20 – Shai Almog Nov 02 '16 at 01:11