How to I make a hyperlink that functions as a button? Or how do I make a button that looks like a hyperlink?
As of GWT 1.5, there is an Anchor widget that should do what you want.
One easy way is to use the Label class. Just create a new label and add a ClickHandler to it. You can then style it however you want using CSS:
Label lbl = new Label("Hello");
lbl.addClickHandler(...);
lbl.setStyleName("hyperlink_style_label");
I also found you can use the anchor class. add a click event and load the method you want as a new page. Inside the page clear the root or other panels you want using the clear() method eg. Rootpanel.get("root panel name").clear();
I wrote the example up and gave an example if you want to check it out. Hope this helps.
Related
The examples on website show many examples of navbars with links.
Image of navbar demo as shown on website.
I want to implement a search bar inside the nav element like this. Is there a way to do it?
I would try with OnRenderLink or linkAs methods.
onRenderLink:
Used to customize how content inside the link tag is rendered
linkAs: Render a custom link in place of
the normal one. This replaces the entire button rather than simply
button content
Source: INavProps interface https://developer.microsoft.com/en-us/fluentui#/controls/web/nav
I need to add sliding functionality to the togglebutton of gwt-bootstrap api. Currently I am having two images(upImage and downImage) which flips on click. I want them to slide.
How can I achieve it? Any idea is appreciated. Thanks in advance.
I don't really know about sliding if you are able to do it with css why not just use a label with a button class onto it and try? Or else here is another option that i would prefer use gwt bootstrap icons along with the newly added spin functionality. Docs is here
Example :
<b:Icon type="ROTATE_RIGHT" size="FOUR_TIMES" spin="true" rotate="ROTATE_180"/>
You can probably call the rotate and spin on click? Helps you?
I want suggestions in suggestBox that is constructed from TextArea to be shown under the current line in text area, because by default it is shown under the whole text area. How can i implement such functionality?
Looking at the source code of SuggestBox, seems like you'll probably have to implement your own SuggestionDisplay, since the default one uses PopupPanel to show suggestions, which is positioned bellow the suggest box:
// Show the popup under the TextBox.
suggestionPopup.showRelativeTo(positionRelativeTo != null
? positionRelativeTo : suggestBox);
Your implementation could also use a PopupPanel but with a setPostion(x,y) and show() instead of showRelativeTo.
hi
I want to display drop down menu like the one you see in this image http://callingcard.marigoholdings.com/Screenshots.html#1
(below From and To)
How can i create that? Any good tutorial.
Best regards
You will have to use UIPicker for this purpose.This is used as a dropdown whereever needed in iPhone.
Please refer the link below
How to create drop down list box for an iphone app
Thanks
It looks like that app is using a combination of a UIWebView and an html select tag. To do something similar would involve a solid bit of html and javascript hackery, but in essence would be:
Create a UIWebView and inject the appropriate HTML into it to make the dropdown.
User uses dropdown as if it was in mobile safari and picks something.
When you need it, you use a javascript call with stringByEvaluatingJavaScriptFromString: to grab the value of the dropdown by id and pass it back to your code.
There are a few gotchas here, mainly with constructing the dropdown and the webview such that it's big enough to show the expanded dropdown but transparent to see under it when the dropdown is not expanded, it's not scrollable, and that sort of thing.
I wonder if a UIActionsheet might be better ... you could easy make a button to call the sheet. Adding multiple buttons to the sheet transforms it into a table that you can scroll.
This sounds like a pretty simple thing to do but I havent been able to find an easy way to do this. How do I create a panel with a title and a border which can contain my widgets? I have seen the SectionStack class which provides this. But I dont want to create a section stack.
Window can be added to a layout and drawn. But is it the only way or is there a container class that I am missing?
Also, how does one center things? Say a textfield and a button at the center of the page. How is this achieved?
If you are using a DynamicForm, you can give it a border and title with
form.setIsGroup(true);
form.setGroupTitle(title);
This actually works for Canvas, too (which is the superclass of most widgets and layouts in SmartGWT).
(I just had the same problem, and found this question, as well as the thread Is there a "titled Border" on the SmartGWT Forums, which gave this answer. I tried and it seems to work.)
To do form-related tasks, look into DynamicForm. To set the inputs in the form, you use setItems(Item...). A text field is a TextItem. You set it's title to control the label that SmartGWT will build. To get a title for the form, the best I've come up with is to use a container canvas that will contain both the title (probably a Label element) and the DynamicForm. To center the inputs, I believe you'd need to use setAlignment on the DynamicForm.
You could create an object that is actually a VLayout that contains a Label (the tile), has a border as you need and includes a Canvas (the generic stuff you want included).
In my experience, I noticed that very often I have a DynamicForm visible, so I just add a BlurbItem control to diplay the tile and a small explanation.