CheckBox setTextPosition(TOP) not working - codenameone

Windows 10 Pro
NetBeans 12.3
Simulator Latest
Simulator, IOS, Android
Setting TextPosition to TOP does not seem to have any affect, The Text is always left or right of the checkbox.
Form hi = new Form("ComboBox TextPosion Test", new BoxLayout(BoxLayout.Y_AXIS));
CheckBox MpiSubSystemSoon = new CheckBox("FYI");
MpiSubSystemSoon.setTextPosition(TOP);
hi.add(MpiSubSystemSoon);
hi.show();
Assumed behavior is the Text "FYI" appears directly above the check box
Thoughts?
Regards

This is in relation to the icon not to the checkbox which is a separate thing. This is a method of Label inherited by CheckBox.
We don't support that layout. To do that place a CheckBox below a Label in the layout.
CheckBox cb = new CheckBox();
Container ui = BoxLayout.encloseY(new Label("My Label"), FlowLayout.encloseCenter(cb));
ui.setLeadComponent(cb);

Related

How to cover two overlapping components with a mask in Sencha ExtJS?

In Sencha, I'm able to mask a background component and bring up a dialog component nicely by calling this.view.mask() on the background component.
Then when I press "Submit" on the top dialog, I want to have a mask cover the dialog and background component all together instead of just masking the smaller dialog box. I don't want to just mask the dialog box, because even though the background is masked too, the dialog box's border is still obviously bright.
How can I mask both components all together?
On the dialog box I tried this.view.mask("Loading..."), but only the small dialog box is masked. Its border is still clearly bright so it's clear we're just putting a mask on the small dialog box rather than on the whole page.
I tried querying the background component via view=Ext.ComponentQuery.query('MyComponent')[0] and then using view.mask("Loading"), but this only adds the mask to that background component.
This is an ugly solution, but it worked for me. Tested on 7.0.0
var wnd = Ext.getCmp('window'), // just an example - Ext.getCmp() use is frowned upon :)
wndSize = wnd.getSize(),
myMask;
myMask = new Ext.LoadMask({
msg : 'Please wait...',
target : wnd,
height: wndSize.height,
width: wndSize.width
});
myMask.show().setXY(wnd.getXY());

top and left line border not showing on Android 7.0

In my cn1-project, the top and left line border for Label, Button and TextField are not shown on an Android 7.0 device. The simulator shows all borders correct. The issue can be easily reproduced with the code from the SignatureComponentDemo on the current cn1 version 4.x for the themes FlatXXXX which also use line borders instead of border images.
I created a new FlatBlue "Get Started App" on Intellij Idea and replaced the code for init(), start(), stop() and destroy() in MyApplication by the code from the SignatureComponentDemo.
The TextField for the name in the demo shows correctly with a line border on the simulator. One the Galaxy S7 edge with Android 7.0 the top and left border of the TextField are missing. Adding more padding for these components has no effect. Also disabling loading of native theme by setting includeNativeBool to false has no effect. The only relevant code is in the following method:
public void start() {
if(current != null){
current.show();
return;
}
Form hi = new Form("Signature Component");
hi.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
hi.add("Enter Your Name:");
hi.add(new TextField());
hi.add("Signature:");
SignatureComponent sig = new SignatureComponent();
sig.addActionListener((evt)-> {
System.out.println("The signature was changed");
Image img = sig.getSignatureImage();
// Now we can do whatever we want with the image of this signature.
});
hi.addComponent(sig);
hi.show();
}
Is there a workaround for this issue? I need to build a table of Components using TableLayout. The table class is no option, because i need to draw borders of different color and thickness and wanted to apply these to the Containers and Components within the container using TableLayout as a layout manager.

Setting the RadioButton "Selected" style in Codename One

I believe the RadioButton "selected" style is not getting set properly.
I am trying to style the radio button using the standard UIID RadioButton in the theme.
I updated the unselected font style to black.
I updated the selected and pressed font style to teal.
It looks like the pressed style works but the selected style does not work. Such that when the radio button is pressed, the font switches to teal but after it gets selected, the font reverts back to black.
Here is the code I used for testing.
Form hi = new Form("Hi World");
hi.addComponent(new RadioButton("Button 1"));
hi.addComponent(new RadioButton("Button 2"));
hi.addComponent(new RadioButton("Button 3"));
hi.show();
First it seems you didn't add the radio buttons to a ButtonGroup which means the radio button won't be selected properly.
Notice the selected style applies to focus of the component and will only appear on touch. It isn't related to the selected state in the radio button which means checked (sorry about that confusing terminology).
I'm guessing you are trying to customize the check symbol which you can customize via theme constants.

Slider in codenameone

Can any one please tell me how i can add slider and moving form in codename one (with sample lines of code) and also want to know are these features supported by all types of devices?
Regards,
Megha
I think you mean how to animate forms changes
Form.setTransitionInAnimator(CommonTransitions.somthing)
Form.setTransitionOutAnimator(CommonTransitions.somthing)
Next, you should handle some "finger slide" event.
To add a slider you can use the following code
Slider jSlider = new Slider();
jSlider.setMaxValue(255);
jSlider.setMinValue(0);
jSlider.setProgress(50); // Set the starting value
jSlider.setEditable(true); // To it works as a slider instead of a progress bar
Now you have created a slider which you can add to your component like you would in Swing. You can type 'jSlider.' in eclipse to find out which other methods you can use, or you can go to the API: http://codenameone.googlecode.com/svn/trunk/CodenameOne/javadoc/com/codename1/ui/Slider.html
I think min/maxValue are selfexplenatory though :)
If you want to open a new form, simply create a new class extending form or do it in code like
Form form = new Form();
form.animate(); // To make it "slide in"
form.show();
Also noteworthy, the slider doesn't work with the lumia skin per default, though you can make it work. I actually asked this question on here as well:
Slider doesn't draw (CodeName One) with Windows phone skin

WebDriver mouseOver is not working properly with selenium grid

My requirement is verifying Image Hover is working or not using Webdriver. In that image tag title value is changing when I mouseover on the image like below.
Normal: [img title="ASPIRIN" "src="http://img.med.com/pi/LNK01570.jpg" class="preview">
if i mouseover on that image:[img title="" "src="http://img.med.com/pi/LNK01570.jpg" class="preview">
So here I'm trying to compare title values to verify the image hover. I have written code for that and it is working fine when I execute the script without using Grid. But using Grid mouseOver is not working properly. Image tag values aren't being changed. Is there any issue with using Grid? I'm using FF17 and Selenium 2.28.0 and Selenium 2.25.0.
My code:
String strVal1 = driver.findElement(By.xpath("//table[#id='ref_priceimgtable']/tbody/tr[12]/td[4]/img")).getAttribute("title");
System.out.println(strVal1);
WebElement element = driver.findElement(By.xpath("//table[#id='ref_priceimgtable']/tbody/tr[12]/td[4]/img"));
Locatable hoverItem = (Locatable) element;
hoverItem.getLocationOnScreenOnceScrolledIntoView();
Mouse mouse = ((HasInputDevices) driver).getMouse();
mouse.mouseMove(hoverItem.getCoordinates());
String strVal2 = driver.findElement(By.xpath("//table[#id='ref_priceimgtable']/tbody/tr[12]/td[4]/img")).getAttribute("title");
System.out.println(strVal1+"Null Value");
In the above code strVal1 and strVal2 should be different.
String strVal1 =driver.findElement(By.xpath("//table[#id='ref_priceimgtable']/tbody/tr[12]/td[4]/img")).getAttribute("title");
System.out.println(strVal1);
WebElement element = driver.findElement(By.xpath("//table[#id='ref_priceimgtable']/tbody/tr[12]/td[4]/img"));
Actions mouseOver = new Actions(driver);
mouseOver .moveToElement(element).build().perform();
String strVal2 = driver.findElement(By.xpath("//table[#id='ref_priceimgtable']/tbody/tr[12]/td[4]/img")).getAttribute("title");
System.out.println(strVal1+"Null Value");
Have you tried this method for mouse over ? If you try this method means , have you called the method for firefox profile "profile.setEnableNativeEvents(true);" ? . the method is necessary to firefox to handle the mouse over in selenium .
Pls try this i think this works fine in grid too.

Resources