TextField (s) custom
Hey guys,.
I have no problem to create my own buttons and graphics using the BlackBerry SDK more. However, I seem to have a problem when the override of the method object fields that allow an entry. For example, when I take a TextField and try the background style, borders, etc, it works fine, UNTIL you try to enter text. At this point it generates mostly text, but not in the dark or the color I try to define it as.
Someone knows something about it, or have an excerpt from the example that I can take a look?
Thank you
jlgosse
Why not use something like:
LabelField alabelField = new LabelField("my text" ,USE_ALL_WIDTH) { public void paint(Graphics graphics) { graphics.setColor(0x00000000); //set the text color super.paint(graphics); } };
Tags: BlackBerry Developers
Similar Questions
-
Horizontal scrolling TextFields custom
Hello friends. I am trying to create a textfield that automatically scrolls horizontally when the field is full. I use a custom class of TextField shown below which I reduced for simplicities sake. I have also included the call that I use. Any ideas why it would not produce a scrolling textfield horiztontally? Thanks to all lots of love.
Create a new TextField in a HorizontalFieldManager
HorizontalFieldManager mgrFirstName = new HorizontalFieldManager (HORIZONTAL_SCROLL);
FirstName TextField = new TextField (BasicEditField.NO_NEWLINE, HORIZONTAL_SCROLL);
mgrFirstName.add (FirstName);
Add (mgrFirstName);
/ * Class TextField custom * /.
SerializableAttribute public class TextField extends HorizontalFieldManager
{
public BasicEditField bEdit = null;
Public TextField (long Style, long scrolling)
{
Super (Scroll);bEdit = new BasicEditField (Style);
Add (bEdit);}
}
Here is a link to an article in the knowledge base that solves this problem. If you want to spruce up the gadget, make sure to read the comments:
-
custom textfield click event do not consume of RET.
Hi all
I implemented a custom text field that extends the BasicEditField...
public CustomTextField (String txt) {}
Super ("", txt, 300, BasicEditField.EDITABLE |) BasicEditField.FOCUSABLE | BasicEditField.ACTION_INVOKE);
isSearchBox = true;
textFieldFont = textFieldFont.derive (Font.PLAIN, 12);
textFieldHeight = textFieldFont.getHeight ();
textFieldWidth = Graphics.getScreenWidth () - 90;
setText (txt);
}It's my constuctor...
When textfield already contains text, it does not consume event back. It shows all the other essential characters but when at the beginning, I click back (from keyboard simulator) no action will take place. Although he has to take because I have no overrided any other method to do anything manually.
Please if anyone know what to do. Please let me know.
Thank you.
Do not use onfocus and unfocus handle and the text field
{} public boolean keyDown (int keyCode, int time) this method with caution... never return true for all keydowns...
-
Problem adding TextFields to the custom preloader.
I create a custom preloader by extending DownloadProgressBar.
In the initialize() method overridden, I add two TextFields, one on top of the label and the progress bar and the other underneath.
It works fine, except that the TextFields new display immediately, before the text of default DownloadProgressBar.
I need the new TextFields to display when the default DownloadProgressBar displays, not beforehand.
Thanks in advance for any help that you could provide.
override public function initialize():void{ super.initialize(); // Attach the title TextField. _titleObj = new TextField(); _titleObj.x = (stageWidth/2)-(borderRect.width/2)+labelRect.x; _titleObj.y = (stageHeight/2)-(borderRect.height/2)+15; _titleObj.width = 165; _titleObj.height = 32; _titleObj.selectable = false; _titleObj.defaultTextFormat = super.labelFormat; _titleObj.htmlText = _title; _titleObj.multiline = true; _titleObj.wordWrap = true; _titleObj.textColor = 0xFFFFFF; super.addChild(_titleObj); // Attach the marquee TextField. _marqueeObj = new TextField(); _marqueeObj.x = (stageWidth/2)-(borderRect.width/2)+labelRect.x; _marqueeObj.y = (stageHeight/2)+(borderRect.height/2)-35; _marqueeObj.width = 165; _marqueeObj.height = 32; _marqueeObj.selectable = false; _marqueeObj.defaultTextFormat = super.labelFormat; _marqueeObj.htmlText = _marquee; _marqueeObj.multiline = true; _marqueeObj.wordWrap = true; _marqueeObj.textColor = 0xFFFFFF; super.addChild(_marqueeObj); }
Try the override of createChildren() instead of initialize
-
Adding scrolling Horizantal to Custom textField
Hello
I wrote a BasicEditField to measure
How to add horizantal scroll to this custom field...?
I added the following, but the text does not appear...
HFM HorizontalFieldManager = new HorizontalFieldManager (Manager.HORIZONTAL_SCROLL |) Manager.NO_HORIZONTAL_SCROLLBAR);
CustomTextField c1 = new CustomTextField ("Enter1:", "", 100, EditField.FILTER_DEFAULT |) EditField.FIELD_LEFT, 200);
HFM. Add (C1);
Add (HFM);Please find my custom here class
SerializableAttribute public class CustomTextField extends BasicEditField
{
private int labelWidth;
public CustomTextField (label As String, String initialValue, int maxNumChars, long style, int fieldWidth)
{
Super (label, initialValue, maxNumChars, style);
labelWidth = getFont () .getAdvance (label);
this.fieldWidth = fieldWidth;
}
public int getPreferredWidth()
{return fieldWidth ;}
public int getPreferredHeight()
{return super.getPreferredHeight () ;}
protected void layout (int width, int height)
{
width = getPreferredWidth();
height = getPreferredHeight();
Super.Layout (width, height);
super.setExtent (width, height);
}
protected void drawFocus (graphics graphics, boolean on)
{super.drawFocus(graphics, on) ;}
protected void paint (Graphics graphics)
{
int w = getWidth();
int h = getHeight();
graphics.drawRect (labelWidth, 0, (o-labelWidth), h);
Super.Paint (Graphics);
}
}Can you please provide a way to add the scroll horizantal bar at this by displaying the text correctly.
Thanks in advance
Please take a look at the developer following the journal article. He's an example of what you're trying to accomplish.
http://NA.BlackBerry.com/eng/developers/resources/journals/jul_2005/creating_textbox_field.jsp
-
How to set the background image in the TextField in Cascade (Custom Field)?
Hello
Someone know how setBackGround image in TextField?
As it actually:
import bb.cascades 1.2 NavigationPane { id: nav Page { Container { Container { layout: DockLayout { } ImageView { imageSource: "asset:///images/chicken.png" } TextField { id: txt text: "Hello" backgroundVisible: false verticalAlignment: VerticalAlignment.Center textStyle.fontSize: FontSize.Large } } } } }
-
problems with application to a textfield focus
It comes to the page, what am I doing wrong?
import bb.cascades 1.0
{Page}
ID: addPage
appScene variant property: Application.scene
Signal custom to notify that this page should be closed
signal is)
title bar: title {} bar
Title: qsTr ("Add Location") + Retranslate.onLocaleOrLanguageChanged
dismissAction: {ActionItem}
Title: "Cancel".
onTriggered: {}
The custom here signal to indicate that this page should be closed
The signal would be treated by the page that invoked it
addPage.done ();
}
}
}
{Of container
background: Color.Transparent
TextField {}
ID: cityfield
hintText: qsTr ("enter city or Postal Code") + Retranslate.onLocaleOrLanguageChanged
inputMode: TextFieldInputMode.Text
input.submitKey: SubmitKey.Search}
}
onAppSceneChanged: {}
This triggers the update if the stage of the application is set to
This Page QML.
cityfield.requestFocus ();
}
}Do you want the text field to get the focus (and pull up the virtual keyboard on Z-devices) as soon as the page is loaded?
Try to create a property on the qml page:
property bool showVKB: false
And add this method in your qml:
onShowVKBChanged: { if (showVKB) { // This focus request shows the VKB if the Page is created via a ComponentDefinition (see main.qml) tfWord.requestFocus(); } }
And then, in your qml page that drives this page, set the showVKB property:
navigationPane.push(page); page.showVKB = true;
-
Hi all
Does anyone know how to create and define keyboard customized to a TextField?
As much as I KNOW there is no way to disable the keyboard, but it would be possible to control the signals emitted by the controls of your text and then hide the virtualkeyboard...
How satisfactory, it will look like I don't know (haven't tried ) and of course the user will always have the possibility to use a scan 2 fingers to the top of the window to bring up the keyboard.
-
Add the custom properties to the standard UI element
Hello
is it possible to add custom properties similar to id or objectName to a standard user interface elements such as textfield and radiogroup?
Best regards
Wildcat
You can use
string myValue property: "myValue".
(or the value later to access it as name.myValue = "123") -
The substitution or replacement TextField Validator icon
Hello
I currently have a validator associated with a TextField, but I want to change the icon that is displayed when the user input is invalid or valid. I don't want the user to input is correct (and thus gets a green check mark) to be confused with the effective verification of the users entry. Is there a way in QML which allows me, or customize the icons used or I need to define my own custom component?
Thank you
before the validators lacked API I did
{onTextChanging}
If the invalid regulations do something
}
-
Slider custom text field (Cap) does not appear
All;
I created a custom text field based on the standard text field, changes work fine (really just a custom height and width and a border). The problem is the method of painting which seems to remove the cap of the field when it gets the focus. To be clear the carret never shown at all.
public class CustomText extends TextField //cutom text field width { //Custom Height and Width in Pixels final static int textwidth=125; final static int textheight=25; CustomText() { super(); // Call the default constructor //Border for text fields XYEdges padding = new XYEdges(5, 5, 5, 5); //space between box and border Border theborder = BorderFactory.createSimpleBorder(padding, Border.STYLE_SOLID); //Assign the border to the object this.setBorder(theborder); } public void onFocus( int direction ) { super.onFocus( direction ); //invoke parent procedure invalidate(); //mark for redraw } public void onUnfocus() { super.onUnfocus(); //invoke parent procedure invalidate(); //mark for redraw } //Override the layout with the custom Width and Height protected void layout(int width, int height) { super.layout(textwidth,textheight); setExtent(textwidth,textheight); } //Override the display message such that no message is displayed when the field is full protected void displayFieldFullMessage() { } //Override the default paint method to call the super class constructor and then assign the border protected void paint(Graphics graphics) { // int prevColor = graphics.getColor(); //Save Previous Color graphics.setBackgroundColor(Color.LIGHTGRAY); // Set to Gray graphics.clear(); // Clear for redraw super.paint(graphics); //Force Redraw of Object // graphics.setColor(prevColor); //restore for cursor paint } };
In the paint in the first and last method lines that are commented out were a soloution that I tried after reading on this subject. Something along the lines of the restoration of the default color, but unfortunately without success. Any ideas would be more useful
Thank you!
Quick thoughts:
(a) to remove the requirement to substitute paint by setting the background a Color.LIGHTGRAY using the base class
(b) you put on the field by using this:
Super.Layout (TextWidth, TextHeight);
If you then do the following:
setExtent (textwidth, textheight);
you are likely to confuse the field. If you still want to use the entire height and use the full width and then try to deal with it in the Style, that is, replace this:
Super(); Call the default constructor
with this
Super(TextField.USE_ALL_HEIGHT |) TextField.USE_ALL_WIDTH); Call the default constructor
(c) why you override onFocus and onUnfocus? I would like to delete these if you do not have anything specific to these methods.
Make these changes, and you'll have a more simple TextField. See if these changes will solve the problem of the caret too.
-
I have a custom dialog box that has two buttons and a textfield. I want to set the focus to textfield when the dialog box opens, how can I do that using qml?
solved. the value of textfield.requestfocus () in onopened() dialogue method
-
Hello
I am completely new to Cascades development - so it's maybe a stupid question... How can I get the text I typed in a TextField from C++?
There is a normal TextField I did in QML (inside a leaf) and responsible for the sheet and she displayed from C++ code. I then added a Signal/Slot connection to the ActionItem "Accept" (in the form) to a method customized (like the slot). But when I get the TextField object in this worksheet (using findChild) and use-> text() myTextField, only the default text is returned, not what I typed.
No idea why?
Destroy the addQml when it is no longer needed by calling "delete addQml", otherwise it will leak memory.
Don't forget to destroy the sheet when closing.
In handleAddList you create a new instance of the worksheet that is why the textfield object is empty.
You can assign addSheet to the Member on creating variable to reference it in handleAddList().
-
How can I use a number of text field custom times?
Hello
is it possible to create a field of custom text so that I can reuse a class several times.
If possible, then pls provide me an example.
thankx.
Similarly...
[] customTextField = new customTextField myArray [2];
myArray [0] = new customTextField();
...
And you can do something like:
MyArray [] TextField = new TextField [] {new TextField(), new customTextField};
-
How to add images to the TextArea or TextField
Hello
I want to add some custom emotion of image to my textarea or textfield.
I try to user with textarea html but they do not support tag.
How to do this
Emoji are supported by all text controls Cascades. See the Emoji section at this link to the documentation for more details on how to use Emoji. However, unfortantely, there currently no API to load custom emoticons.
Maybe you are looking for
-
H9-1080uk new for ME - no sound
Hello I just bought a 1080uk h9 for ME (Windows 7 64-bit) and set up, everything works fine, but I'm having a problem with the audio. I don't have speakers, I tried to update the sound card drivers, followed all the help Windows and HP files, made so
-
I have a HP Pavilion g6-2235TX, that will not power on. The only sign of life is the led near the charger port, which shows a constant white when it is connected to the electric network. There is no fan noise, no screen display and no other activity.
-
HP has me turn off the firewall, hide windows programs, uninstall HP System. I also cleaned the registry, disk and defrag, I also downloaded the hotfix from Microsoft and it is impossible to identify the problem or difficulty there. At one point I
-
Windows 7, reset to factory settings
I have window 7 laptop I want to restore the settings with that it's a MS1 installed with Windows 7 home premium. He had repaired some time ago and since that time to receive messages from windows on counterfeits thus cannot switch to windows 10. Bou
-
Start window began to open randomly for no reason at all.
I'm about 2 weeks ago and operating Windows 7 the start window began to open randomly for no reason at all. It remains open, then closes or it will close when I click on the screen what ever is open, BUT the start window could then reopen immediately