need help to create custom keypad INSIDE a dialogFragment. do not want system keyboard to pop out - keypad

i have created an XML and dialog fragment consist of Edittext and numeric buttons (keypad). i had searched alot but only found creating custom softkey solutions. my objective is very simple. i already had all the buttons created in XML. what should i add to so that when "1" is pressed, edittext will display "1", "2" is pressed display "12", 3 will display "123"... etc. some source code for me would be useful,
I know how to display "1" in edit text when i pressed "1", which method to use to display 2 next to 1 when i press 2

In XML insert onClick commands for each button. In your activity, create a method for each onClick defined, this way:
In XML:
<Button ...
android:onClick="one" />
In the activity you should have a method like this one:
public void one(View v) {
yourEditText.setText(yourEditText.getText().toString() + "1");
}
It should work. You can always use getText() to get the content and setText(newText) to set the content. Please note that if you click on the EditText this way you will still get the system keyboard pop up, if you want to only show the value use a TextView instead.
Hope it helps.

Related

Add text next to UI Form action icon in toolbar?

Is there a way to add text next to the action icon in the toolbar of an eclipse RCP UI Form? If you do not assign the Action an ImageDescriptor, the action will be displayed containing only text. If you do give it an ImageDescriptor, it displays only the image. I want to display both side by side, within one button - is there a way to do this?
This will have only the text "Description" in the button on the toolbar:
myAction = new Action("Description", SWT.PUSH) {
#Override
public void run() {}
};
myForm.getToolBarManager().add(myAction);
But adding an image will cause the the text to be replaced:
myAction.setImageDescriptor(newImage);
I was eventually able to find an answer to my issue, hopefully it's helpful to anyone else who runs into this problem. I found this in the Eclipse Rich Client Platform (2nd Ed.) book.
The Action must be converted to an ActionContributionItem with its mode set to MODE_FORCE_TEXT. This will display both the text and the image in the toolbar.
ActionContributionItem aCI = new ActionContributionItem(myAction);
aCI.setMode(ActionContributionItem.MODE_FORCE_TEXT);
myForm.getToolBarManager().add(aCI);

Customize button clear in Orbeon

Is it possible to customize 'clear' button in form runner? I want to keep some default values in form (after user clics on this button), and I want to 'clear' button leave those values and doesn't clear them.
Now I want to add refresh button or add refresh action to clear button. In my properties I have line:
<property
as="xs:string"
name="oxf.fr.detail.buttons.*.*"
value="refresh pdf save-draft review workflow-send"/>
But unfortunately in form runner I don't see refresh button
If you add 'fr:buttons' tag into your form, you're able to add your own buttons. This tag should be placed in '<fr:view>' just after the '</fr:body>'. If you have configured the property oxf.fr.detail.buttons.*.* to define the buttons that you want to show, it will override it. You have to explicitly place the buttons that you want to show, e.g. <fr:save-button/>.
I've created a quick example to show it. The following fr:buttons would show a custom clean button together with Orbeon's 'Save' and 'PDF' buttons:
<fr:buttons xmlns:oxf="http://www.orbeon.com/oxf/processors"
xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:xbl="http://www.w3.org/ns/xbl">
<fr:button>
<xf:label ref="'Clear'"/><!--You can change it to a localized path-->
<xf:action ev:event="DOMActivate">
<!--Clean fields, but keep values for lastname and phone fields-->
<xf:setvalue xxf:iterate="instance('fr-form-instance')/section-1/*[name()!='lastname' and name()!='phone']"/>
</xf:action>
</fr:button>
<fr:pdf-button/> <!--Orbeon PDF button-->
<fr:save-button/> <!--Orbeon save button-->
</fr:buttons>
You can see another example about custom buttons in the following link: http://wiki.orbeon.com/forms/how-to/fb-fr/form-builder-wizard

showForm, Command Action, and going-back

Going "back" from a form doesn't take me to the previous form but back to the main form. What am I doing wrong? Here's more detail:
I have a Command that takes you from the main form of my app to a "human setup" form. From that form if you click on a certain multibutton I go to another form (MaintenanceLevel) like this:
protected void onHumanSetup_MultiButtonMaintenanceAction(Component c, ActionEvent event) {
// Invoke the next level of form
showForm("MaintenanceLevel", null);
}
In the "MaintenanceLevel" form I have an Action set to Back, but when I click the menu bar to go back I end up back on the main-form and not the "human setup" where I want to be.
Edit:
Things have got a little worse!! Now when I go back in to view the Commands for my MaintenanceLevel form it's empty: it's forgetting the command I've entered :(
Here is my command setting for MaintenanceLevel form:
You don't need to define a back command. Remove it. Codename One automatically creates back commands for you.
The usage for this option is when you create a Button and place it within the form, then you want it to behave as a back button effectively (e.g. cancel button).

Google Closure add onclick to button after adding this button with custom editor plugin

I am making a custom plugin for the editor provided by Google Closure. The plugin makes it able to add a button.
I am having problems by setting an onclick on the button, the other values are nicely set.
button.innerHTML = event.label;
button.className = event.initialClass;
var extraClasses = event.extraClasses;
if (extraClasses)
{
button.className += ' ' + extraClasses
}
button.onclick = function() { event.onclick };
Does anyone know what I am doing wrong and how I can fix this?
After creating a button it is added to the editors SeamlessField. A second problem that I currently have is that after creating the button, my pointer is inside the button and I can't seem to get it out of there.
I've got the follow piece of code for handling this at the moment. The var button is the created button. button contains: <button class="orange">test</button>
// We want to insert the button in place of the user's selection.
// So we restore it first, and then use it for insertion.
this.restoreOriginalSelection();
var range = this.fieldObject.getRange();
button = range.replaceContentsWithNode(button);
// Done making changes, notify the editor.
this.fieldObject.dispatchChange();
// Put the user's selection right after the newly inserted button.
goog.editor.range.placeCursorNextTo(button, false);
// Dispatch selection change event because we just moved the selection.
this.fieldObject.dispatchSelectionChangeEvent();
Any ideas about how I could fix this second problem aswell?
For the first, it does not look like you have begun using Google Closure event code. Wiring up the button to the 'click' event in Google Closure would be as follows:
goog.events.listen(button, goog.events.EventType.CLICK, event.onclick)
You should also be investigating the goog.dom and goog.dom.classes namespaces if you'd like to use Google Closure's wrappers around standard CSS class and text DOM manipulation.
For the second, were you testing in Chrome? If so, you might have ran into a range issue in Webkit, documented within the Closure code itself:
https://code.google.com/p/closure-library/source/browse/closure/goog/editor/range.js#174
I have gotten around this in the past by inserting an empty <span> element as a sibling after the offending element (the button, in your case), and placing the cursor next to the <span> instead. However, there's nothing stopping the user from moving the cursor back inside your button. You'll have to add more logic to prevent a user from placing the cursor within the button's text.

ImgButton : How to tell SmartGWT to not concatene state on the name of file source?

private ImgButton button = new ImgButton();
...
button.setSrc("iconName.jpg");
GWT or SmartGWT, I cannot tell exactly, generate state word to concatene it on the name of file.
Example to clarify :
On focus, iconName.jpg become iconName_Focus.jpg
On mouse down click, iconName.jpg become iconName_Down.jpg
On over, iconName.jpg become iconName_Over.jpg
Because these images are custom images, I want to tell GWT to take a default image when I didn't provide the corresponding image.
For example, when over event is fire and iconName_Over.jpg does not exist then use iconName.jpg.
Use the setShow{State} or setShow{State}Icon methods accordingly. For example for disabling the mouse down state, use setShowDown(Boolean.FALSE). For not showing a different icon when the mouse goes down on the button, use the setShowDownIcon(Boolean.FALSE). The rest of the actions have accordingly named methods you can look up at the ImgButton's javadoc page.