Re: [codenameone-discussions] Issue with the Simulator

2018-04-10 Thread Shai Almog
We might want to have a special case on the top level form to block 
opacity/transparency manipulation.

-- 
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+unsubscr...@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/d4987145-ccf4-4bda-bc47-55ff5697c637%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [codenameone-discussions] Issue with the Simulator

2018-04-10 Thread Thomas
EDIT: just found the origin of the issue. In my Login Form I had "
setInlineAllStyles("transparency:0; opacity:255; alignment:center;");" . 
Removing 
the "transparency:0" parametter solved the issue.

On Monday, March 26, 2018 at 10:25:22 PM UTC+2, Steve Hannah wrote:
>
> It appears that initFirstTheme() sets the global resources file.  This is 
> the effective difference, as when you call the no-args constructor of your 
> form, it uses the global resource file.  I'll need to look into it deeper 
> to see what the correct behaviour should be (whether the result you're 
> getting is correct or not).
>
> Steve
>
> On Mon, Mar 26, 2018 at 12:24 PM, Thomas  > wrote:
>
>> I suppose that my CN1 plugin is up to date (I had an automatic update 
>> notification 2 or 3 days ago). I tested in eclipse and Netbeans with the 
>> same result
>> my CN1 libs are also up to date (but just to be sure, I performed a new 
>> "refresh CN1libs libs" but that didn"t change anything) 
>>
>> I found how to fix the issue with my login Form. In my main class, if I 
>> do:
>> theme = UIManager.initFirstTheme("/theme");
>> instead of
>>  try {
>>  Resources theme = Resources.openLayered("/theme");
>> 
>>  
>> UIManager.getInstance().setThemeProps(theme.getTheme(theme.getThemeResourceNames()[0]));
>> } catch (IOException e) {
>>  e.printStackTrace();
>> }
>> that works (but I don't understand why as initFirstTheme() is suposed to 
>> be  a shorthand notation of the latest...)
>>
>> However, if I do that, my Login Form (= Sign In) layout is all messed up 
>> again, like in my previous post! (whereas it is OK when I use the second 
>> code with try catch):
>>
>>
>> 
>>
>>
>>
>> Here is the code of my MainApplication class:
>>
>> package org.tbdlab.cn1test;
>>
>> import static com.codename1.ui.CN.addNetworkErrorListener;
>> import static com.codename1.ui.CN.updateNetworkThreadCount;
>>
>> import org.tbdlab.cn1test.screens.Launch;
>>
>> import com.codename1.io.Log;
>> import com.codename1.ui.Dialog;
>> import com.codename1.ui.Display;
>> import com.codename1.ui.Form;
>> import com.codename1.ui.SideMenuBar;
>> import com.codename1.ui.Toolbar;
>> import com.codename1.ui.plaf.UIManager;
>> import com.codename1.ui.util.Resources;
>>
>> /**
>>  * This file was generated by > href="https://www.codenameone.com/;>Codename 
>> One for the purpose 
>>  * of building native mobile applications using Java.
>>  */
>> @SuppressWarnings("deprecation")
>> public class MyApplication 
>> {
>> private Form current;
>> private Resources theme;
>> private Form home;
>>
>> 
>> public void init(Object context) {
>>
>> // use two network threads instead of one
>> updateNetworkThreadCount(2);
>>
>> theme = UIManager.initFirstTheme("/theme");
>> /*
>> try {
>> Resources theme = Resources.openLayered("/theme");
>> 
>> UIManager.getInstance().setThemeProps(theme.getTheme(theme.getThemeResourceNames()[0]));
>> } catch (IOException e) {
>> e.printStackTrace();
>> }
>> */
>> 
>> // Enable Toolbar on all Forms by default
>> Toolbar.setGlobalToolbar(true);
>>
>> // Pro only feature
>> //Log.bindCrashProtection(true);
>>
>> //Side menu
>> 
>> Display.getInstance().setCommandBehavior(Display.COMMAND_BEHAVIOR_SIDE_NAVIGATION);
>> 
>> UIManager.getInstance().getLookAndFeel().setMenuBarClass(SideMenuBar.class);
>>  
>> 
>> addNetworkErrorListener(err -> {
>> // prevent the event from propagating
>> err.consume();
>> if(err.getError() != null) {
>> Log.e(err.getError());
>> }
>> Log.sendLogAsync();
>> Dialog.show("Connection Error", "There was a networking error 
>> in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
>> });
>>   
>> }
>> 
>>
>> public void start() {
>> if (current != null) {
>> current.show();
>> return;
>> }
>> 
>> Form hi = new Launch();
>> hi.show();
>> }
>>
>> public void stop() {
>> current = Display.getInstance().getCurrent();
>> if(current instanceof Dialog) {
>> ((Dialog)current).dispose();
>> current = Display.getInstance().getCurrent();
>> }
>> }
>>
>> public void destroy() {
>> }
>>
>> 
>> }
>>
>> The one of my Launch Form:
>>
>> package org.tbdlab.cn1test.screens;
>>
>> import com.codename1.ui.Form;
>>
>>
>> public class Launch extends com.codename1.ui.Form  {
>> public Launch() {
>> this(com.codename1.ui.util.Resources.getGlobalResources());
>> }
>> 
>> public 

Re: [codenameone-discussions] Issue with the Simulator

2018-04-10 Thread Thomas
I put you a small example on 
github: https://github.com/ramsestom/CN1GUI_test in case this can help you 
track the issue (this is the login form layout that is broken on the 
simulator or on a real android device).


On Monday, March 26, 2018 at 10:25:22 PM UTC+2, Steve Hannah wrote:
>
> It appears that initFirstTheme() sets the global resources file.  This is 
> the effective difference, as when you call the no-args constructor of your 
> form, it uses the global resource file.  I'll need to look into it deeper 
> to see what the correct behaviour should be (whether the result you're 
> getting is correct or not).
>
> Steve
>
> On Mon, Mar 26, 2018 at 12:24 PM, Thomas  > wrote:
>
>> I suppose that my CN1 plugin is up to date (I had an automatic update 
>> notification 2 or 3 days ago). I tested in eclipse and Netbeans with the 
>> same result
>> my CN1 libs are also up to date (but just to be sure, I performed a new 
>> "refresh CN1libs libs" but that didn"t change anything) 
>>
>> I found how to fix the issue with my login Form. In my main class, if I 
>> do:
>> theme = UIManager.initFirstTheme("/theme");
>> instead of
>>  try {
>>  Resources theme = Resources.openLayered("/theme");
>> 
>>  
>> UIManager.getInstance().setThemeProps(theme.getTheme(theme.getThemeResourceNames()[0]));
>> } catch (IOException e) {
>>  e.printStackTrace();
>> }
>> that works (but I don't understand why as initFirstTheme() is suposed to 
>> be  a shorthand notation of the latest...)
>>
>> However, if I do that, my Login Form (= Sign In) layout is all messed up 
>> again, like in my previous post! (whereas it is OK when I use the second 
>> code with try catch):
>>
>>
>> 
>>
>>
>>
>> Here is the code of my MainApplication class:
>>
>> package org.tbdlab.cn1test;
>>
>> import static com.codename1.ui.CN.addNetworkErrorListener;
>> import static com.codename1.ui.CN.updateNetworkThreadCount;
>>
>> import org.tbdlab.cn1test.screens.Launch;
>>
>> import com.codename1.io.Log;
>> import com.codename1.ui.Dialog;
>> import com.codename1.ui.Display;
>> import com.codename1.ui.Form;
>> import com.codename1.ui.SideMenuBar;
>> import com.codename1.ui.Toolbar;
>> import com.codename1.ui.plaf.UIManager;
>> import com.codename1.ui.util.Resources;
>>
>> /**
>>  * This file was generated by > href="https://www.codenameone.com/;>Codename 
>> One for the purpose 
>>  * of building native mobile applications using Java.
>>  */
>> @SuppressWarnings("deprecation")
>> public class MyApplication 
>> {
>> private Form current;
>> private Resources theme;
>> private Form home;
>>
>> 
>> public void init(Object context) {
>>
>> // use two network threads instead of one
>> updateNetworkThreadCount(2);
>>
>> theme = UIManager.initFirstTheme("/theme");
>> /*
>> try {
>> Resources theme = Resources.openLayered("/theme");
>> 
>> UIManager.getInstance().setThemeProps(theme.getTheme(theme.getThemeResourceNames()[0]));
>> } catch (IOException e) {
>> e.printStackTrace();
>> }
>> */
>> 
>> // Enable Toolbar on all Forms by default
>> Toolbar.setGlobalToolbar(true);
>>
>> // Pro only feature
>> //Log.bindCrashProtection(true);
>>
>> //Side menu
>> 
>> Display.getInstance().setCommandBehavior(Display.COMMAND_BEHAVIOR_SIDE_NAVIGATION);
>> 
>> UIManager.getInstance().getLookAndFeel().setMenuBarClass(SideMenuBar.class);
>>  
>> 
>> addNetworkErrorListener(err -> {
>> // prevent the event from propagating
>> err.consume();
>> if(err.getError() != null) {
>> Log.e(err.getError());
>> }
>> Log.sendLogAsync();
>> Dialog.show("Connection Error", "There was a networking error 
>> in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
>> });
>>   
>> }
>> 
>>
>> public void start() {
>> if (current != null) {
>> current.show();
>> return;
>> }
>> 
>> Form hi = new Launch();
>> hi.show();
>> }
>>
>> public void stop() {
>> current = Display.getInstance().getCurrent();
>> if(current instanceof Dialog) {
>> ((Dialog)current).dispose();
>> current = Display.getInstance().getCurrent();
>> }
>> }
>>
>> public void destroy() {
>> }
>>
>> 
>> }
>>
>> The one of my Launch Form:
>>
>> package org.tbdlab.cn1test.screens;
>>
>> import com.codename1.ui.Form;
>>
>>
>> public class Launch extends com.codename1.ui.Form  {
>> public Launch() {
>> this(com.codename1.ui.util.Resources.getGlobalResources());
>> }
>> 

Re: [codenameone-discussions] Issue with the Simulator

2018-03-26 Thread Steve Hannah
It appears that initFirstTheme() sets the global resources file.  This is
the effective difference, as when you call the no-args constructor of your
form, it uses the global resource file.  I'll need to look into it deeper
to see what the correct behaviour should be (whether the result you're
getting is correct or not).

Steve

On Mon, Mar 26, 2018 at 12:24 PM, Thomas  wrote:

> I suppose that my CN1 plugin is up to date (I had an automatic update
> notification 2 or 3 days ago). I tested in eclipse and Netbeans with the
> same result
> my CN1 libs are also up to date (but just to be sure, I performed a new
> "refresh CN1libs libs" but that didn"t change anything)
>
> I found how to fix the issue with my login Form. In my main class, if I do:
> theme = UIManager.initFirstTheme("/theme");
> instead of
>  try {
>  Resources theme = Resources.openLayered("/theme");
>  UIManager.getInstance().setThemeProps(theme.getTheme(
> theme.getThemeResourceNames()[0]));
> } catch (IOException e) {
>  e.printStackTrace();
> }
> that works (but I don't understand why as initFirstTheme() is suposed to
> be  a shorthand notation of the latest...)
>
> However, if I do that, my Login Form (= Sign In) layout is all messed up
> again, like in my previous post! (whereas it is OK when I use the second
> code with try catch):
>
>
> 
>
>
>
> Here is the code of my MainApplication class:
>
> package org.tbdlab.cn1test;
>
> import static com.codename1.ui.CN.addNetworkErrorListener;
> import static com.codename1.ui.CN.updateNetworkThreadCount;
>
> import org.tbdlab.cn1test.screens.Launch;
>
> import com.codename1.io.Log;
> import com.codename1.ui.Dialog;
> import com.codename1.ui.Display;
> import com.codename1.ui.Form;
> import com.codename1.ui.SideMenuBar;
> import com.codename1.ui.Toolbar;
> import com.codename1.ui.plaf.UIManager;
> import com.codename1.ui.util.Resources;
>
> /**
>  * This file was generated by https://www.codenameone.com/;>Codename
> One for the purpose
>  * of building native mobile applications using Java.
>  */
> @SuppressWarnings("deprecation")
> public class MyApplication
> {
> private Form current;
> private Resources theme;
> private Form home;
>
>
> public void init(Object context) {
>
> // use two network threads instead of one
> updateNetworkThreadCount(2);
>
> theme = UIManager.initFirstTheme("/theme");
> /*
> try {
> Resources theme = Resources.openLayered("/theme");
> UIManager.getInstance().setThemeProps(theme.getTheme(
> theme.getThemeResourceNames()[0]));
> } catch (IOException e) {
> e.printStackTrace();
> }
> */
>
> // Enable Toolbar on all Forms by default
> Toolbar.setGlobalToolbar(true);
>
> // Pro only feature
> //Log.bindCrashProtection(true);
>
> //Side menu
> Display.getInstance().setCommandBehavior(Display.
> COMMAND_BEHAVIOR_SIDE_NAVIGATION);
> UIManager.getInstance().getLookAndFeel().
> setMenuBarClass(SideMenuBar.class);
>
>
> addNetworkErrorListener(err -> {
> // prevent the event from propagating
> err.consume();
> if(err.getError() != null) {
> Log.e(err.getError());
> }
> Log.sendLogAsync();
> Dialog.show("Connection Error", "There was a networking error
> in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
> });
>
> }
>
>
> public void start() {
> if (current != null) {
> current.show();
> return;
> }
>
> Form hi = new Launch();
> hi.show();
> }
>
> public void stop() {
> current = Display.getInstance().getCurrent();
> if(current instanceof Dialog) {
> ((Dialog)current).dispose();
> current = Display.getInstance().getCurrent();
> }
> }
>
> public void destroy() {
> }
>
>
> }
>
> The one of my Launch Form:
>
> package org.tbdlab.cn1test.screens;
>
> import com.codename1.ui.Form;
>
>
> public class Launch extends com.codename1.ui.Form  {
> public Launch() {
> this(com.codename1.ui.util.Resources.getGlobalResources());
> }
>
> public Launch(com.codename1.ui.util.Resources resourceObjectInstance)
> {
> initGuiBuilderComponents(resourceObjectInstance);
> this.getToolbar().hideToolbar();
> }
>
> //-- DON'T EDIT BELOW THIS LINE!!!
> private com.codename1.ui.Button gui_CreateAccountButton = new
> com.codename1.ui.Button();
> private com.codename1.ui.Button gui_SignInButton = new
> com.codename1.ui.Button();
> private com.codename1.components.ScaleImageLabel gui_Logo = new
> com.codename1.components.ScaleImageLabel();
>
>
> // 
>
> private void 

Re: [codenameone-discussions] Issue with the Simulator

2018-03-26 Thread Steve Hannah
I just copied the source code you posted directly into a project that uses
the blue theme, and this was the result in the Simulator.



I'm not sure why you'd be getting different results.  Perhaps your project
is using an older version of the libs.  Make sure that:

1. Your Codename One plugin is up to date with the latest.
2. That your project libs are up to date.  (I.e. Project Properties > Click
"Update project libs".


WRT hiding the titlebar altogether, try this:
https://stackoverflow.com/questions/42871223/how-do-i-hide-get-rid-the-title-bar-on-a-form-codename-one

Steve


On Fri, Mar 23, 2018 at 12:36 PM, Thomas  wrote:

> The SignInForm UIID was the source of the issue. Thanks. (Not sure why
> taking a screenshot changed the layout though...)
> I now have another issue with the simulator.
>
> Here is the source code of my class generated with the GUI builder:
>
> import com.codename1.ui.Form;
>
>
> public class Launch extends com.codename1.ui.Form  {
> public Launch() {
> this(com.codename1.ui.util.Resources.getGlobalResources());
> }
>
> public Launch(com.codename1.ui.util.Resources resourceObjectInstance)
> {
> initGuiBuilderComponents(resourceObjectInstance);
> }
>
> //-- DON'T EDIT BELOW THIS LINE!!!
> private com.codename1.ui.Button gui_CreateAccountButton = new
> com.codename1.ui.Button();
> private com.codename1.ui.Button gui_SignInButton = new
> com.codename1.ui.Button();
> private com.codename1.components.ScaleImageLabel gui_Logo = new
> com.codename1.components.ScaleImageLabel();
>
>
> // 
>
> private void guiBuilderBindComponentListeners() {
> EventCallbackClass callback = new EventCallbackClass();
> gui_CreateAccountButton.addActionListener(callback);
> gui_SignInButton.addActionListener(callback);
> }
>
> class EventCallbackClass implements 
> com.codename1.ui.events.ActionListener,
> com.codename1.ui.events.DataChangedListener {
> private com.codename1.ui.Component cmp;
> public EventCallbackClass(com.codename1.ui.Component cmp) {
> this.cmp = cmp;
> }
>
> public EventCallbackClass() {
> }
>
> public void actionPerformed(com.codename1.ui.events.ActionEvent
> ev) {
> com.codename1.ui.Component sourceComponent = ev.getComponent();
>
> if(sourceComponent.getParent().getLeadParent() != null &&
> (sourceComponent.getParent().getLeadParent() instanceof
> com.codename1.components.MultiButton || 
> sourceComponent.getParent().getLeadParent()
> instanceof com.codename1.components.SpanButton)) {
> sourceComponent = sourceComponent.getParent().
> getLeadParent();
> }
>
> if(sourceComponent == gui_CreateAccountButton) {
> onCreateAccountButtonActionEvent(ev);
> }
> if(sourceComponent == gui_SignInButton) {
> onSignInButtonActionEvent(ev);
> }
> }
>
> public void dataChanged(int type, int index) {
> }
> }
> private void initGuiBuilderComponents(com.codename1.ui.util.Resources
> resourceObjectInstance) {
> guiBuilderBindComponentListeners();
> setLayout(new com.codename1.ui.layouts.LayeredLayout());
> setInlineStylesTheme(resourceObjectInstance);
> setScrollableY(false);
> setInlineStylesTheme(resourceObjectInstance);
> addComponent(gui_CreateAccountButton);
> addComponent(gui_SignInButton);
> addComponent(gui_Logo);
> gui_CreateAccountButton.setText("Create an account");
> gui_CreateAccountButton.setInlineStylesTheme(
> resourceObjectInstance);
> gui_CreateAccountButton.setInlineAllStyles("border:round ffbb
> rect; fgColor:ff; opacity:255; bgImage:; alignment:center;
> padding:2.5mm 2.5mm 2.5mm 2.5mm;");
> gui_CreateAccountButton.setName("CreateAccountButton");
> gui_CreateAccountButton.setTextPosition(com.codename1.
> ui.Component.LEFT);
> ((com.codename1.ui.layouts.LayeredLayout)gui_
> CreateAccountButton.getParent().getLayout()).setInsets(gui_CreateAccountButton,
> "auto 5.0mm 5.0mm 5.0mm").setReferenceComponents(gui_CreateAccountButton,
> "-1 -1 -1 -1").setReferencePositions(gui_CreateAccountButton, "0.0 0.0
> 0.0 0.0");
> gui_SignInButton.setText("Sign in");
> gui_SignInButton.setInlineStylesTheme(
> resourceObjectInstance);
> gui_SignInButton.setInlineAllStyles("border:round ff5bc8fb rect;
> fgColor:ff; opacity:255; bgImage:; alignment:center; padding:2.5mm
> 2.5mm 2.5mm 2.5mm;");
> gui_SignInButton.setName("SignInButton");
> gui_SignInButton.setTextPosition(com.codename1.ui.Component.LEFT);
> ((com.codename1.ui.layouts.LayeredLayout)gui_
> SignInButton.getParent().getLayout()).setInsets(gui_SignInButton, "auto
> 5.0mm 3.0mm 5.0mm").setReferenceComponents(gui_SignInButton, "-1 -1 

Re: [codenameone-discussions] Issue with the Simulator

2018-03-25 Thread Thomas
The SignInForm UIID was the source of the issue. Thanks. (Not sure why 
taking a screenshot changed the layout though...)
I now have another issue with the simulator.

Here is the source code of my class generated with the GUI builder:

import com.codename1.ui.Form;


public class Launch extends com.codename1.ui.Form  {
public Launch() {
this(com.codename1.ui.util.Resources.getGlobalResources());
}

public Launch(com.codename1.ui.util.Resources resourceObjectInstance) {
initGuiBuilderComponents(resourceObjectInstance);
}

//-- DON'T EDIT BELOW THIS LINE!!!
private com.codename1.ui.Button gui_CreateAccountButton = new 
com.codename1.ui.Button();
private com.codename1.ui.Button gui_SignInButton = new 
com.codename1.ui.Button();
private com.codename1.components.ScaleImageLabel gui_Logo = new 
com.codename1.components.ScaleImageLabel();


// 
  
private void guiBuilderBindComponentListeners() {
EventCallbackClass callback = new EventCallbackClass();
gui_CreateAccountButton.addActionListener(callback);
gui_SignInButton.addActionListener(callback);
}

class EventCallbackClass implements 
com.codename1.ui.events.ActionListener, 
com.codename1.ui.events.DataChangedListener {
private com.codename1.ui.Component cmp;
public EventCallbackClass(com.codename1.ui.Component cmp) {
this.cmp = cmp;
}

public EventCallbackClass() {
}

public void actionPerformed(com.codename1.ui.events.ActionEvent ev) 
{
com.codename1.ui.Component sourceComponent = ev.getComponent();

if(sourceComponent.getParent().getLeadParent() != null && 
(sourceComponent.getParent().getLeadParent() instanceof 
com.codename1.components.MultiButton || 
sourceComponent.getParent().getLeadParent() instanceof 
com.codename1.components.SpanButton)) {
sourceComponent = 
sourceComponent.getParent().getLeadParent();
}

if(sourceComponent == gui_CreateAccountButton) {
onCreateAccountButtonActionEvent(ev);
}
if(sourceComponent == gui_SignInButton) {
onSignInButtonActionEvent(ev);
}
}

public void dataChanged(int type, int index) {
}
}
private void initGuiBuilderComponents(com.codename1.ui.util.Resources 
resourceObjectInstance) {
guiBuilderBindComponentListeners();
setLayout(new com.codename1.ui.layouts.LayeredLayout());
setInlineStylesTheme(resourceObjectInstance);
setScrollableY(false);
setInlineStylesTheme(resourceObjectInstance);
addComponent(gui_CreateAccountButton);
addComponent(gui_SignInButton);
addComponent(gui_Logo);
gui_CreateAccountButton.setText("Create an account");

gui_CreateAccountButton.setInlineStylesTheme(resourceObjectInstance);
gui_CreateAccountButton.setInlineAllStyles("border:round ffbb 
rect; fgColor:ff; opacity:255; bgImage:; alignment:center; 
padding:2.5mm 2.5mm 2.5mm 2.5mm;");
gui_CreateAccountButton.setName("CreateAccountButton");

gui_CreateAccountButton.setTextPosition(com.codename1.ui.Component.LEFT);

((com.codename1.ui.layouts.LayeredLayout)gui_CreateAccountButton.getParent().getLayout()).setInsets(gui_CreateAccountButton,
 
"auto 5.0mm 5.0mm 5.0mm").setReferenceComponents(gui_CreateAccountButton, 
"-1 -1 -1 -1").setReferencePositions(gui_CreateAccountButton, "0.0 0.0 0.0 
0.0");
gui_SignInButton.setText("Sign in");

gui_SignInButton.setInlineStylesTheme(resourceObjectInstance);
gui_SignInButton.setInlineAllStyles("border:round ff5bc8fb rect; 
fgColor:ff; opacity:255; bgImage:; alignment:center; padding:2.5mm 
2.5mm 2.5mm 2.5mm;");
gui_SignInButton.setName("SignInButton");
gui_SignInButton.setTextPosition(com.codename1.ui.Component.LEFT);

((com.codename1.ui.layouts.LayeredLayout)gui_SignInButton.getParent().getLayout()).setInsets(gui_SignInButton,
 
"auto 5.0mm 3.0mm 5.0mm").setReferenceComponents(gui_SignInButton, "-1 -1 0 
-1").setReferencePositions(gui_SignInButton, "0.0 0.0 1.0 0.0");
gui_Logo.setPreferredSizeStr("50.0mm inherit");
gui_Logo.setInlineStylesTheme(resourceObjectInstance);
gui_Logo.setName("Logo");

com.codename1.ui.FontImage.setMaterialIcon(gui_Logo,"\ue3f4".charAt(0));

((com.codename1.ui.layouts.LayeredLayout)gui_Logo.getParent().getLayout()).setInsets(gui_Logo,
 
"5.0mm auto 5.0mm auto").setReferenceComponents(gui_Logo, "-1 -1 1 
-1").setReferencePositions(gui_Logo, "0.0 0.0 1.0 0.0");
}// 

//-- DON'T EDIT ABOVE THIS LINE!!!
 
public void 
onSignInButtonActionEvent(com.codename1.ui.events.ActionEvent ev) {
Form loginf = new Login();
//loginf.getToolbar().setBackCommand("", e -> ((Form) 
ev.getComponent().getParent()).showBack());

Re: [codenameone-discussions] Issue with the Simulator

2018-03-24 Thread Shai Almog
All UIID's exist. You will get the default UIID value when you use 
something that doesn't exist. Since the default value (which you can edit 
in the designer) is transparent the form is transparent and you get 
problematic behavior. 

We could check for transparent forms but this might be a problem as there 
are cases where this is legal e.g. when embedding forms, in dialogs or if 
you implement your own bg painter.

The blue line at the top is the Toolbar or TitleArea UIID if you set it to 
background transparency 0 and Border = Empty in the designer it will 
disappear. It's there because we have a different UIID above it called 
StatusBar which takes up 2mm to make room for the clock/battery/notch 
symbols in iOS. 

I'm not sure why the styles aren't showing up correctly, Steve would have 
to answer that one as it's a relatively new feature.

-- 
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+unsubscr...@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/9d73366c-aa47-4e1a-abfc-224cb7c093d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [codenameone-discussions] Issue with the Simulator

2018-03-24 Thread Thomas
The "SignInForm" UIID was the issue (would be nice to have an exception 
thrown in the simulator console when an UUID doesn't exist). Thanks

I have another issue with the simulator. 
Here is the code of my Form produced by the new GUI builder:

import com.codename1.ui.Form;


public class Launch extends com.codename1.ui.Form  {
public Launch() {
this(com.codename1.ui.util.Resources.getGlobalResources());
}

public Launch(com.codename1.ui.util.Resources resourceObjectInstance) {
initGuiBuilderComponents(resourceObjectInstance);
}

//-- DON'T EDIT BELOW THIS LINE!!!
private com.codename1.ui.Button gui_CreateAccountButton = new 
com.codename1.ui.Button();
private com.codename1.ui.Button gui_SignInButton = new 
com.codename1.ui.Button();
private com.codename1.components.ScaleImageLabel gui_Logo = new 
com.codename1.components.ScaleImageLabel();


// 
  
private void guiBuilderBindComponentListeners() {
EventCallbackClass callback = new EventCallbackClass();
gui_CreateAccountButton.addActionListener(callback);
gui_SignInButton.addActionListener(callback);
}

class EventCallbackClass implements 
com.codename1.ui.events.ActionListener, 
com.codename1.ui.events.DataChangedListener {
private com.codename1.ui.Component cmp;
public EventCallbackClass(com.codename1.ui.Component cmp) {
this.cmp = cmp;
}

public EventCallbackClass() {
}

public void actionPerformed(com.codename1.ui.events.ActionEvent ev) 
{
com.codename1.ui.Component sourceComponent = ev.getComponent();

if(sourceComponent.getParent().getLeadParent() != null && 
(sourceComponent.getParent().getLeadParent() instanceof 
com.codename1.components.MultiButton || 
sourceComponent.getParent().getLeadParent() instanceof 
com.codename1.components.SpanButton)) {
sourceComponent = 
sourceComponent.getParent().getLeadParent();
}

if(sourceComponent == gui_CreateAccountButton) {
onCreateAccountButtonActionEvent(ev);
}
if(sourceComponent == gui_SignInButton) {
onSignInButtonActionEvent(ev);
}
}

public void dataChanged(int type, int index) {
}
}
private void initGuiBuilderComponents(com.codename1.ui.util.Resources 
resourceObjectInstance) {
guiBuilderBindComponentListeners();
setLayout(new com.codename1.ui.layouts.LayeredLayout());
setInlineStylesTheme(resourceObjectInstance);
setScrollableY(false);
setInlineStylesTheme(resourceObjectInstance);
addComponent(gui_CreateAccountButton);
addComponent(gui_SignInButton);
addComponent(gui_Logo);
gui_CreateAccountButton.setText("Create an account");

gui_CreateAccountButton.setInlineStylesTheme(resourceObjectInstance);
gui_CreateAccountButton.setInlineAllStyles("border:round ffbb 
rect; fgColor:ff; opacity:255; bgImage:; alignment:center; 
padding:2.5mm 2.5mm 2.5mm 2.5mm;");
gui_CreateAccountButton.setName("CreateAccountButton");

gui_CreateAccountButton.setTextPosition(com.codename1.ui.Component.LEFT);

((com.codename1.ui.layouts.LayeredLayout)gui_CreateAccountButton.getParent().getLayout()).setInsets(gui_CreateAccountButton,
 
"auto 5.0mm 5.0mm 5.0mm").setReferenceComponents(gui_CreateAccountButton, 
"-1 -1 -1 -1").setReferencePositions(gui_CreateAccountButton, "0.0 0.0 0.0 
0.0");
gui_SignInButton.setText("Sign in");

gui_SignInButton.setInlineStylesTheme(resourceObjectInstance);
gui_SignInButton.setInlineAllStyles("border:round ff5bc8fb rect; 
fgColor:ff; opacity:255; bgImage:; alignment:center; padding:2.5mm 
2.5mm 2.5mm 2.5mm;");
gui_SignInButton.setName("SignInButton");
gui_SignInButton.setTextPosition(com.codename1.ui.Component.LEFT);

((com.codename1.ui.layouts.LayeredLayout)gui_SignInButton.getParent().getLayout()).setInsets(gui_SignInButton,
 
"auto 5.0mm 3.0mm 5.0mm").setReferenceComponents(gui_SignInButton, "-1 -1 0 
-1").setReferencePositions(gui_SignInButton, "0.0 0.0 1.0 0.0");
gui_Logo.setPreferredSizeStr("50.0mm inherit");
gui_Logo.setInlineStylesTheme(resourceObjectInstance);
gui_Logo.setName("Logo");

com.codename1.ui.FontImage.setMaterialIcon(gui_Logo,"\ue3f4".charAt(0));

((com.codename1.ui.layouts.LayeredLayout)gui_Logo.getParent().getLayout()).setInsets(gui_Logo,
 
"5.0mm auto 5.0mm auto").setReferenceComponents(gui_Logo, "-1 -1 1 
-1").setReferencePositions(gui_Logo, "0.0 0.0 1.0 0.0");
}// 

//-- DON'T EDIT ABOVE THIS LINE!!!
 
public void 
onSignInButtonActionEvent(com.codename1.ui.events.ActionEvent ev) {
Form loginf = new Login();
//loginf.getToolbar().setBackCommand("", e -> ((Form) 

Re: [codenameone-discussions] Issue with the Simulator

2018-03-23 Thread Steve Hannah
The "SignInForm" UIID doesn't appear to be picked up.  Note:  If you
comment out that line, it works fine.
setUIID("SignInForm");

So double check and make sure that you are working with the same theme file
- and that the SignInForm UIID is registered in that theme file.

Steve

On Thu, Mar 22, 2018 at 9:40 PM, Thomas  wrote:

> I am using the new GUI builder to create a Login Form. In the GUI builder
> preview, everything looks fine and correctly reflect the constraint and
> components properties I defined in the GUI builder. But when launching the
> similator, my layout is a complete mess and even show components that are
> not even part of this form (like the "SIGN IN" button that is actually a
> buton part of the previously displayed form. See picture below).
> Here is the code of my login form:
>
>
> public class Login extends com.codename1.ui.Form {
>
> public Login() {
> this(com.codename1.ui.util.Resources.getGlobalResources());
> }
>
> public Login(com.codename1.ui.util.Resources resourceObjectInstance) {
> initGuiBuilderComponents(resourceObjectInstance);
>}
>
> //-- DON'T EDIT BELOW THIS LINE!!!
> private com.codename1.ui.TextField gui_Email = new
> com.codename1.ui.TextField();
> private com.codename1.ui.TextField gui_Password = new
> com.codename1.ui.TextField();
> private com.codename1.ui.Button gui_LoginButton = new
> com.codename1.ui.Button();
>
>
> // 
>
> private void initGuiBuilderComponents(com.codename1.ui.util.Resources
> resourceObjectInstance) {
> setLayout(new com.codename1.ui.layouts.LayeredLayout());
> setInlineStylesTheme(resourceObjectInstance);
> setScrollableY(false);
> setUIID("SignInForm");
> setInlineStylesTheme(resourceObjectInstance);
> setInlineAllStyles("alignment:center;");
> setTitle("Sign In");
> setName("Login");
> addComponent(gui_Email);
> addComponent(gui_Password);
> addComponent(gui_LoginButton);
> gui_Email.setHint("Email");
> gui_Email.setUIID("SignInEmail");
> gui_Email.setInlineStylesTheme(resourceObjectInstance);
> gui_Email.setName("Email");
> gui_Email.setRows(1);
> ((com.codename1.ui.layouts.LayeredLayout)gui_Email.
> getParent().getLayout()).setInsets(gui_Email, "5.0mm 5.0mm auto 5.0mm").
> setReferenceComponents(gui_Email, "-1 -1 -1 
> -1").setReferencePositions(gui_Email,
> "0.0 0.0 0.0 0.0");
> gui_Password.setHint("Password");
> gui_Password.setUIID("SignInPassword");
> gui_Password.setInlineStylesTheme(resourceObjectInstance);
> gui_Password.setName("Password");
> gui_Password.setRows(1);
> ((com.codename1.ui.layouts.LayeredLayout)gui_Password.
> getParent().getLayout()).setInsets(gui_Password, "5.0mm 0.0mm auto
> 0.0mm").setReferenceComponents(gui_Password, "0 0 -1 0
> ").setReferencePositions(gui_Password, "1.0 0.0 0.0 0.0");
> gui_LoginButton.setText("Login");
> gui_LoginButton.setInlineStylesTheme(
> resourceObjectInstance);
> gui_LoginButton.setName("LoginButton");
> ((com.codename1.ui.layouts.LayeredLayout)gui_LoginButton.
> getParent().getLayout()).setInsets(gui_LoginButton, "10.0mm 5.0mm auto
> 5.0mm").setReferenceComponents(gui_LoginButton, "1 -1 -1
> -1").setReferencePositions(gui_LoginButton, "1.0 0.0 0.0 0.0");
> }// 
>
> //-- DON'T EDIT ABOVE THIS LINE!!!
> }
>
> And here is what I obtain in the simulator:
>
>
> 
>
> And when I take a screenshot of the simulator, the display change and here
> is what I obtain:
>
>
> 
>
> (Still not the correct result as the background is black rather than white
> but at least the layout seems ok. Too bad I have to take a screenshot for
> the simulator to reflect the layout of my code though...)
>
> What can be the orgin of this issue and how can I fix it? (as, as it is,
> the simulator is just unusable for me now...).
> Maybe I am not correctly navigating from my previous Form from this one (I
> am new to CN1 and had difficulties finding a tutorial showing navigation
> examples. The only "how to" CN1 video on navigation is based on the old GUI
> builder and do not show any code for navigating from one Form to another)?
> Here is how I open this new Form from an onpress action event on a previous
> Form button:
>
> public void onSignInButtonActionEvent(com.codename1.ui.events.ActionEvent
> ev) {
> Form loginf = new Login();
> loginf.show();
> }
>
>
> I tested in Eclipse and Netbeans but the result is the same with both
> plugins. And I a made a clean/rebuild of my project with no effect. Also
>