Reference retrieval of a ButtonGroup instance - codenameone

I have created an instance of ButtonGroup and associated that to two RadioButtons. The RadioButtons are added to a Container and the Container added to a Form screen. When the "Back" button is pressed, I want to clear the ButtonGroup selection and reset certain variable instances.
I want to place the code in the ActionListener I have made for the "Back" function. My question is how to retrieve the reference of the ButtonGroup in order to clearSelection()?

Generally we recommend recreating the Form instead of caching it if you intend to "reset it" so I'd avoid this.
If you still want to go in this direction check out getButtonGroup() in RadioButton. You can also set a new group with the setter method.
You can use setUnselectAllowed(true) then invoke setSelected(false) on both buttons. Then restore default selection behavior using setUnselectAllowed(false).

While looking at animateLayout() method of ComponentSelector for another issue that I had, I realized that I may use this Class to obtain Component object references jQuery style elegantly. Very powerful and useful concept for codename one.
should adding or removing components trigger a repaint?

Related

ReactJS MUI Select Component: Get pre-select value

Is there a native MUI event for when the pre-selection value changes in a MUI:Select component?
For example, here is my MUI:Select component with 3 options:
I would like an event for when 'Public', 'Restricted' or 'Private' is pre-selected (but not actually selected; i.e. before the onChange() event), either with a mouse-over event or a keyboard up/down event. This is because I have a tooltip card that needs to change dynamically for the user as they interact with the options.
Using this example https://codesandbox.io/s/3iv96 as a guide, I implemented a bespoke solution by capturing the mouse-over event and extracting the text value. I just realized I have forgotten to handle key up/down.
So the question becomes whether I have just missed the obvious, or do I need to roll my own component by wrapping MUI:Select and publishing the events I need.
Looks like out of the box this isn't supported.
Looking at this thread https://github.com/JedWatson/react-select/issues/745 it has to be done manually.

How can I add a badge to a tab in CodenameOne?

I tried this code:
FloatingActionButton badge = FloatingActionButton.createBadge("33");
badge.bindFabToContainer(tabs.getTabComponentAt(3), Component.RIGHT, Component.TOP);
However for some reason I get a
java.lang.IllegalArgumentException: Component is already contained in Container
exception.
I tried also:
tabs.getTabsContainer().getComponentAt(3)
without success.
Bind creates a new container that should be added instead of the component. This won't work for a case like tabs where the button be added when you add a tab component. You are also relying on internal behavior of looking up a specific tab which is pretty fragile to begin with.
You can use the approach listed here which shows how you can create a completely custom component to represent a tab.

Configuring bottom bar in QLPreviewController

I have integrated QLPreviewController and UIDocumentInteractionController in my app, and it is working fine.
The only problem is- I want to configure the bottom toolbar, I want to remove the default toolbar items, which appear as shown in image below:
Is there any way to do so, please suggest.
Short Answer: NO, Not in IOS6+
Description:
One thing to note about QLPreviewController is that it's not meant to be customized. There were other libraries allowing you to change the functionality such as:
https://github.com/rob-brown/RBFilePreviewer
Which are not working in iOS 6+ since apple made a big change in QLPreviewController and it's technically running in a separate process. Although it might be possible (not sure) using private apis but your app will be rejected then.
You can find more info about this change here:
http://oleb.net/blog/2012/10/remote-view-controllers-in-ios-6/
Hope this helps
Subclass UIToolbar
Create UINavigationController using
init(navigationBarClass:toolbarClass:) and supply UIToolbar subsclass created in step 1 for toolbarClass
Create QLPreviewController instance and push onto UINavigationController stack
Inside of UIToolbar subsclass override
setItems(_:animated:). To remove all buttons call super with empty array super.setItems([], animated: false) or potentially you can add only buttons you want to keep.
Present UINavigationController created in step 2
Here is the example PreviewControllerHideBottomButtons
Subclass QLPreviewController.
Search for the Toolbar in the view hierarchy.
Have a UIToolbar property in your class that has the same frame as the original toolbar.
Place your own toolbar above the default one with whatever buttons you want.
If you want it to be hidden as the default behavior of the QLPreviewController you can key value observe the hidden property of the default toolbar and present / hide your own accordingly.

how to change the position of textfield in adf forms?

Hi friends i am using jdev 11g release2 (11.1.2.4.0).I want to create a registration form from dragging datas from data control and my question was how to change or move the position of textfield in that form into different areas?
You should be using various layout components to achieve the layout you want, and remember that layout components can be nested to create more complex layouts.
See some examples here:
http://jdevadf.oracle.com/adf-richclient-demo/faces/feature/layoutForm.jspx
You can use the view source menu to see how they achieved that.
http://jdevadf.oracle.com/adf-richclient-demo/faces/feature/layoutBasics.jspx
Please be a bit more clear in your query. From what I was able to make out:
You can either use the "code view" of the JDev to move the code which represents the component to a different location or use the "Design view" to drag and move the component.
I would recommend the first approach as it makes it easier to manage the code/layout
You can change the position of the fields within the form or you can drag them out. However for this you should try out some tests and see which suits you best. I think if you surround each attribute with "Panel label and message" you will have a better view of your page.

When I add a new Form in the Ide, it gets default properties, but I always use a different font and a different background color

Adding a new Form in the project creates a default form with default properties. I have to change them manually, but in all my project I have the same properties (font, background color, etc.).
Is there a way I can change the default Ide template for Forms?
Not using inheritance as Adrian recommended is a mistake. It is the right way to do it because you can in one fell swoop change every form in your app by editing the base form properties.
But you want to change the template. That's easy to do as well. Start a new scratch project with one Form and change the properties you want to have customized. Click File + Export Template. Select Item template, Next. Tick the form, Next. Next. Give it a good name and description and click Finish. You can now select that template whenever you create a new form.
Create your own form control that is derived from the base one and has all the properties set just like you want them, then you can use this one all over your project. Also changing something will be very easy since you'll have to do it only in one place.

Resources