Im using codename one 3.5.8 and need to add a checkbox to a multibutton(as the example https://www.codenameone.com/javadoc/com/codename1/components/MultiButton.html) but when adding it to my code ,it seems as though it is being ignored, the checkbox is not adde to my multibutton, this behavior happens on the emulator and also on my test device(android 6.0). is there anything that needs to be apllied additional to setCheckBox(true)
img2:
img3:
In case somebody is having this same behavior, the problem is because in some themes, the checkbox images make the checkbox invisible,the solution is to delete(or replace) the checkbox related images in the constant tab(on theme editor) like explained here:
CodenameOne - change color of checkbox in theme
The MultiButton itself should become a checkbox and would be rendered based on API conventions. You might need a revalidate() if the button is already showing in the UI.
Form hi = new Form("Multibutton", BoxLayout.y());
MultiButton component = new MultiButton();
component.setTextLine1("Name");
component.setTextLine2("Numero de reservacion:");
component.setTextLine3("Fecha de reservacion:");
component.setTextLine4("Estado:");
component.setCheckBox(true);
hi.addComponent(component);
hi.show();
Related
I have to navigate between my components and I use a custom button like this:
button.addClickListener(click -> {
UI.getCurrent().navigate(ClassToNavigate.class);
});
The url does refresh in the search bar but it only shows a black page, I've to hit F5 to see the component in my parent layout.
My only fix is to add:
UI.getCurrent().getPage().reload();
...which reloads the page after navigating to the URL, and that breaks the UX in my opinion, however... when using a BeforeEnterEvent on a class and using the method:
forwardTo(ClassToNavigate.class);
redirects perfectly... although I can't have BeforeEnterEvent for every menu button I have, I can't see why forwardTo() works perfectly and navigate() doesn't.
Is there a way to navigate without having to reload the page? And without using RouterLink which I can't because I'm already using a custom component.
Thanks in advance!
So still kind of figuring out JavaFX, I was able to disable entering text in the textbox but I am not sure how to prevent the context menu from coming up when right clicked. Is anybody aware of how to prevent the default context menu from popping up when right clicked? `
//CombatFeedback is scrollable textbox to update user on what's happening.
TextArea CombatFeedback= new TextArea("Text.");
CombatFeedback.setPrefColumnCount(20);
CombatFeedback.setPrefRowCount(5);
CombatFeedback.setWrapText(true);
CombatFeedback.setStyle("-fx-font: 20 arial");
CombatFeedback.setEditable(false);
ScrollPane scrollerCombat = new ScrollPane(CombatFeedback);`
You can consume the event that signifies a request has been made for a context menu:
CombatFeedback.addEventFilter(ContextMenuEvent.CONTEXT_MENU_REQUESTED, Event::consume);
Anyone help on this....
code
I want to access the hyperlink within my text as depicted in the pic :
Notes:
I tried directly clicking in text by using id but didnt worked.
I tried using scrollTo() but still it didnt worked.
I tried with linkText even that didnt worked.
clickable is set to false. You have to set it true in xml file and later on handle onClick event in your activity class
image only you need to handle onclick listener in Android java file where you make reference the text of your xml like
TextView mytext=(TextView)findviewbyid(R.id.ref of your TextView);
mytext.setOnClickList();
I've tried using the new FileDownloader in Vaadin7. Unfortunately, it needs an AbstractComponent for the "extend" component (where it listens for the clicks)
Is there a way to use it with combobox items? As they are not AbstractComponents and thus do not fit with the "extend" method.
The Vaadin forums have discussed this a lot, and there is no scheme now using FileDownloader or the similarly functioning BrowserWindowOpener. They all only work on AbstractComponents, and thus don't work on Action handlers for Table and Tree, or row click handlers on Table, or MenuItem in Menu, etc. The same applies to selected elements in their various select boxes.
You have to revert to the popup window style (so browsers will need to allow popups for it to work) using a regular click/valuechange listener, creating a Resource and passing it to the deprecated, but still working, Page.getCurrent().open(Resource...) method.
Here is my work-around. It works like a charm for me. Hope it will help you.
This example is for the MenuItem, but you can modify for ComboBox.
Create a button and hide it by Css (NOT by code: button.setInvisible(false))
final Button downloadInvisibleButton = new Button();
downloadInvisibleButton.setId("DownloadButtonId");
downloadInvisibleButton.addStyleName("InvisibleButton");
In your theme, add this rule to hide the downloadInvisibleButton:
.InvisibleButton {
display: none;
}
When the user clicks on menuItem: extend the fileDownloader to the downloadInvisibleButton, then simulate the click on the downloadInvisibleButton by JavaScript.
menuBar.addItem("Download", new MenuBar.Command() {
#Override
public void menuSelected(MenuBar.MenuItem selectedItem) {
FileDownloader fileDownloader = new FileDownloader(...);
fileDownloader.extend(downloadInvisibleButton);
//Simulate the click on downloadInvisibleButton by JavaScript
Page.getCurrent().getJavaScript()
.execute("document.getElementById('DownloadButtonId').click();");
}
});
I have seen some details from
http://google-web-toolkit.googlecode.com/svn/javadoc/2.0/com/google/gwt/dom/client/Style.Cursor.html
Did not see any example using this. I have put css class style but still cursor does not get the required cursor style.
can any one give an example please.?
This might be helpful
button.getElement().getStyle().setCursor(Cursor.POINTER);
But gwt prefer css directly
and by adding css style to the button(**preffered**)
button.addStyleName(mybuttonStyle);
.mybuttonStyle{
cursor: pointer;
}
In case this is a SmartGWT application and you want to set the cursor for a SmartGWT widget, you can use Canvas.setCursor().
IButton button = new IButton("Hover over");
button.setCursor(Cursor.CROSSHAIR);
http://forums.smartclient.com/showthread.php?p=68560