refer to his car in custom text field calc
I have a custom for a text field calculation, but I would like to know if it is possible to set the field itself as a variable without having to refer to the field name. EITHER this.getField ("name") works, but I want to use this same script a number other text fields and do not want to customize each one.
To get a reference to the field to which the script is attached, the field object is the value of event.target, so the code could be simplified as follows:
// Custom Calculate script event.target.readonly = getField("Set 1").value === "Off" ? true : false;
I changed to the analysis with a value of "Off", because the script didn't need to know what is the value of exports from the box. A deselected checkbox will have a value of "Off". This makes the script more generic.
Tags: Acrobat
Similar Questions
-
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 want to implement a custom text field that displays its label on the leading edge of a line and its part editable on the TRAILING edge of the same way like a ChoiceField. Is there a documentation available to achieve this (maybe it's to say-sample code)? Or even if I could see the source code for ChoiceField. I develop for a Blackberry Pearl 8110 with 4.3.
I ended up solve this using managers of horizontal inside vertical management. I have to use a label field for the edit field that accompanies it. When lines are added, I followed is the width of the new label. Then in sublayout to align the edit fields according to the maximum width more stored a Variant. Could not align all the way to the right.
import net.rim.device.api.ui.*; import net.rim.device.api.ui.container.*; import net.rim.device.api.ui.component.*; import net.rim.device.api.ui.text.*; public class MyLayoutManager extends VerticalFieldManager { protected int maxw; protected Font font; protected int font_height; private int size; public MyLayoutManager() { super(Field.USE_ALL_WIDTH); this.maxw = 0; this.font = Font.getDefault().derive(Font.PLAIN, 12); this.font_height = this.font.getHeight(); this.size = 0; } public void addLine(String label, int initial) { MyEditField mef = new MyEditField(label, initial); int label_width = this.font.getAdvance(label); this.maxw = Math.max(label_width, this.maxw); this.add(mef); this.size++; } public int getPreferredHeight() { return this.size * this.font_height; } public int getPreferredWidth() { return 240; } protected void sublayout(int maxwidth, int maxheight) { int y = 0; for (int i = 0; i < this.size; i++) { Field f = this.getField(i); this.setPositionChild(f, 0, y); this.layoutChild(f, 240, this.getPreferredHeight()); y += this.font_height; } this.setExtent(240, this.getPreferredHeight()); } protected class MyEditField extends HorizontalFieldManager { private LabelField the_label; private JunkField the_value; public MyEditField(String label, int initial) { super(Field.USE_ALL_WIDTH); this.the_label = new LabelField(label); this.the_label.setFont(font); this.the_value = new JunkField(initial + ""); this.the_value.setFont(font); this.add(this.the_label); this.add(this.the_value); } public int getPreferredHeight() { return font_height; } public int getPreferredWidth() { return 240; } protected void sublayout(int maxwidth, int maxheight) { Field f = this.getField(0); this.setPositionChild(f, 0, 0); this.layoutChild(f, maxwidth, maxheight); f = this.getField(1); this.setPositionChild(f, maxw + 20, 0); this.layoutChild(f, maxwidth, maxheight); this.setExtent(maxwidth, font_height); } private class JunkField extends EditField { private boolean firstFocus; public JunkField(String deflt) { super(Field.EDITABLE | Field.FOCUSABLE); this.setText(deflt); this.setFilter(new NumericTextFilter(TextFilter.NUMERIC)); this.firstFocus = false; } protected void onFocus(int direction) { this.firstFocus = true; } protected boolean keyChar(char key, int status, int time) { if (this.firstFocus) { this.setText(""); this.firstFocus = false; } return super.keyChar(key, status, time); } } } }
-
Format custom text field only when the field is filled
I have created a form that I need to have the format of a text field "model:"& value of text field, then when it is empty so it is just empty.»
I put event.value = "template:" + event.value; "." in the format custom properties of the text field it set to format correctly, but if it had not entered in this field he said always model: so what should I do for it to be only occur when there is something entered in the field.
Change to:
If (event.value) event.value = "template:"+ event.value; ".
-
Error when creating custom text field
HI Guyz,
I am getting below error while creating a new custom UDF text field. All the world is facing this problem earlier?
"Houston-COLUMN_UNAVAILABLE: no additional custom attributes of this type cannot be created"
Swati - PÉAN
The problem is finally solved.
Yes, there are several udf to IOM. However, it stores the details in a table of the adf. Cleaning of the custom fields were created.
TRUNCATE TABLE ADF_EXTENSION_COLUMN_USAGE;
DELETE ADF_EXTENSIBLE_TABLE_USAGE;
COMMIT;
-Swati Pandey
-
How to make a text field that starts with "Dear," pulls a name to a different field, then ends with a comma?
If the name of the other field is 'Name', say, you can use this code as the custom code of the field:
var name = this.getField("Name").value;
If (name) event.value = 'Expensive' + name + by ', ';
else event.value = "";
-
Please help me with the custom text field FormCalc
There is someone online has done a very good thing for me - they helped me create a text field that would be of type 'this document has been printed on _' and include some day the pdf was printed on the employer's intranet site.
I had a shortcut in my favorites and would click on it and place it on each new document that I needed on.
Because the computer I was using suddenly fell down, can't get the details of how to set it up again. I have a pdf form that includes the box, but when I open it in LiveCycle, it's just empty.
That's what I saved:
< field h = mm "8,4935" name = "PrintedOn" w = "141,0398 mm" x = "-0,0001 mm" y = "0 mm" xmlns ="http://www.xfa.org/schema/xfa-template/2.5/" > ""
< ui >
< textEdit >
< border hand = 'right' presence = "hidden" >
<? templateDesigner styleId aped0? > < / border >
< margin / >
< / textEdit >
< /UI >
< police size = cast "18pt" = "Tahoma" weight = "bold" >
< filling >
< color value = "221,221,221" / >
< / filling >
< / make >
< para hAlign = "center" vAlign = "middle" / >
< link match = "none" / >
< activity = "prePrint" ref = "$host" >
< script >$ .rawValue = concat ("this document has been printed on:", num2date (date (), DateFmt (1))); < /script >
< / event >
< / field >I don't remember what to do to get this working.
I use this text box "print on" ALL the time, and I need to know what to do to get back to work quickly.
If there is someone who could help me, I could also send you a sample of a form which includes it - so you can see exactly what I mean.
If someone could remember how to program this kind of thing in once again and save it in LiveCycle, then explain how I can put it on another computer so I'd really, REALLY appreciate it.
~ Chris
PS - this one as I had put in place only prints print message per day on the first page. If she could somehow print on EACH page of the PDF file without me having to click and add it to each page individually, it would be better... but let's first!
Hello
The script is here. If you place a new textfield in the Master Page and put the following script in the event of pre-publication of the field:
$ = concat("This document was printed on: ", num2date(date(), DateFmt(1)))
The language is FormCalc.
Please note that you don't need to go to the XML Source for this. Simply select the textfield object and open the Script Editor (in the Windows menu). Drag the bottom of the editor bar so that you can see a few lines, and then set the FormCalc language.
Should work,
Niall
-
LiveCycle - police car in the text field
I use 8 Professional - Livecycle and I have several areas of text field. I want to make the police in 'auto' text fields where they are trying to set within the area. I have trouble finding in via Livecycle. I can find it on my Adobe regular but not Livecycle. Help, please!
Thank you
I was able to understand. I just need to change the font to zero size.
Thanks for your help.
-
public class CustText extends TextField{ private String _text; private FontFamily _fontFamily1; private int _size, _color; private Font _headFont = null; public CustText(String _text, int _size,int _color, long _property) { super(_property); this._text = _text; this._size = _size; this._color = _color; } protected void paint(Graphics g) { try{ _fontFamily1 = FontFamily.forName("aerial"); } catch(ClassNotFoundException e) { _fontFamily1 = Font.getDefault().getFontFamily(); } _headFont = _fontFamily1.getFont(Font.PLAIN,_size); g.setColor(_color); g.setFont(_headFont); g.drawText(_text,0, 0); } }
I use the above code to customTextfield, the problem here is, when it is used to display long text that does not move to the next line, only the first line is painted, the rest of the lines are missing
Graphics.drawText draws text on a single line. This example allows input of multi line.
-
focus with custom text field problem
Hello
I am new to BB dev., trying to write a small program with two CustomTextFields, but faceing the problem, then try to verify that CustomTextField is selected (the focus).
CustomTextField (NumericTextField)
import net.rim.device.api.ui.Manager; import net.rim.device.api.ui.Field; import net.rim.device.api.ui.component.EditField; import net.rim.device.api.system.Display; import net.rim.device.api.system.Characters; import net.rim.device.api.ui.Graphics; import net.rim.device.api.ui.Font; public class NumericTextField extends Manager { private final static int DEFAULT_LEFT_MARGIN = 10; private final static int DEFAULT_RIGHT_MARGIN = 10; private final static int DEFAULT_TOP_MARGIN = 5; private final static int DEFAULT_BOTTOM_MARGIN = 5; private final static int DEFAULT_LEFT_PADDING = 10; private final static int DEFAULT_RIGHT_PADDING = 10; private final static int DEFAULT_TOP_PADDING = 5; private final static int DEFAULT_BOTTOM_PADDING = 5; private int topMargin = DEFAULT_TOP_MARGIN; private int bottomMargin = DEFAULT_BOTTOM_MARGIN; private int leftMargin = DEFAULT_LEFT_MARGIN; private int rightMargin = DEFAULT_RIGHT_MARGIN; private int topPadding = DEFAULT_TOP_PADDING; private int bottomPadding = DEFAULT_BOTTOM_PADDING; private int leftPadding = DEFAULT_LEFT_PADDING; private int rightPadding = DEFAULT_RIGHT_PADDING; private int totalHorizontalEmptySpace = leftMargin + leftPadding + rightPadding + rightMargin; private int totalVerticalEmptySpace = topMargin + topPadding + bottomPadding + bottomMargin; private int minHeight = getFont().getHeight() + totalVerticalEmptySpace; private int width = Display.getWidth(); private int height = minHeight; private EditField editField; public NumericTextField() { super(0); editField = new EditField(EditField.FILTER_REAL_NUMERIC); add(editField); } protected void sublayout(int width, int height) { Field field = getField(0); layoutChild(field, this.width - totalHorizontalEmptySpace, this.height - totalVerticalEmptySpace); setPositionChild(field, leftMargin+leftPadding, topMargin+topPadding); setExtent(this.width, this.height); } public void setTopMargin(int topMargin) { this.topMargin = topMargin; } public void setBottomMargin(int bottomMargin) { this.bottomMargin = bottomMargin; } protected void paint(Graphics graphics) { graphics.drawRoundRect(leftMargin, topMargin, width - (leftMargin+rightMargin), height - (topMargin+bottomMargin), 5, 5); boolean longText = false; EditField ef = (EditField)getField(0); String entireText = ef.getText(); String textToDraw = ""; Font font = getFont(); int availableWidth = width - totalHorizontalEmptySpace; if (font.getAdvance(entireText) <= availableWidth) { textToDraw = entireText; } else { int endIndex = entireText.length(); for (int beginIndex = 1; beginIndex < endIndex; beginIndex++) { textToDraw = entireText.substring(beginIndex); if (font.getAdvance(textToDraw) <= availableWidth) { longText = true; break; } } } if (longText == true) { ef.setText(textToDraw); super.paint(graphics); ef.setText(entireText); } else { super.paint(graphics); } } public int getPreferredWidth() { return width; } public int getPreferredHeight() { return height; } protected boolean keyChar(char ch, int status, int time) { if (ch == Characters.ENTER) { return true; } else { return super.keyChar(ch, status, time); } } public String getText() { return ((EditField)getField(0)).getText(); } public void setText(final String text) { ((EditField)getField(0)).setText(text); } }
and in my screen content trying to check:
NumericTextField focusImput() { NumericTextField focusField; if (_fieldFrom.isFocus()) { focusField = _fieldtFrom; } else { focusField = _fieldTo; } return focusField; }
but it always returns me _fieldTo...
NumericTextField definition:
_fieldFrom = new NumericTextField(); _fieldFrom.setChangeListener(this); manager.add(_fieldFrom); _fieldTo = new NumericTextField(); _fieldTo.setChangeListener(this); manager.add(_fieldTo);
Maybe someone to guide me how to correctly focus feature?
Thanks in advance.
Then you need two slightly customized EditFields - their main customization would be limiting their width, as well as making them focusable/unfocusable. So, something like this should work:
public class NumericTextField extends EditField { // override the constructors used in your code, adding FILTER_REAL_NUMERIC // ... private int maxWidth = Integer.MAX_VALUE >> 1; private boolean focusable = true; protected void layout(int width, int height) { super.layout(Math.min(maxWidth, width), height); } public void setMaxWidth(int width) { maxWidth = width; updateLayout(); } public boolean isFocusable() { return (isStyle(FOCUSABLE) & focusable); } public void setFocusable(boolean on) { focusable = on; } }
If you want to place the fields, use setMargin - he is documented in OS 6.0 but works since OS 4.2.
Use setMaxWidth to, well, set desired maximum width (otherwise EditField tenorman to the top of the entire available width). Use the setFocusable to toggle the field. In addition, you can play with the Visual States for the field you turn, but it's an exersize for another day. First of all make sure that it works and you know how to use it.
-
Getpreferredwidth and getpreferredheight custom text field
I have a customtextfield that I have to get the width of textfields, I tried getpreferredwidth() substitution but I'm stacoverflowmethod, I can understand the reason for the error but I tried getwidth() substitution I get 10 as standard response. I am not able to understand the error.
public class CustTextField extends RichTextField{ private String _text; private FontFamily _fontFamily1; private int _size, _color; private Font _headFont = null; public CustTextField(String _text, int _size,int _color, long _property) { super(_text, _property); FontFamily _fontFamily1; this._color = _color; try{ _fontFamily1 = FontFamily.forName("aerial"); } catch(ClassNotFoundException e) { _fontFamily1 = Font.getDefault().getFontFamily(); } _headFont = _fontFamily1.getFont(Font.PLAIN,_size); super.setFont(_headFont); } public int getPreferredWidth() { // TODO Auto-generated method stub return getPreferredWidth(); } protected void paint(net.rim.device.api.ui.Graphics g) { g.setColor(_color); super.paint(g); } }
A Y
You can use font.getAdvance
-
Rich text field, scroll problems
Hello world
I currently have a problem with the rich text fields. I have a selected rich when custom text field (onFocus), it colors the blue text when not selected (onUnfocus), the text is white.
I have Setup several of my RichTextFields in a VerticalFieldManager so they can be scrolled as a list.
Now scrolling works on the following simulators:
Bold 9000 4.6.0.266
Curve 8520 4.6.1.272
But no scrolling does work on this Simulator:
Bold 9700 5.0.442
What Miss me? I know the o/s changed, but if it should not be backward compatible?
I use Blackberry JDE component Package 4.2.1
Any help would be greatly appreciated.
I found the problem. The super I was calling was super (text, Field.FOCUSABLE), this caused the 9700 Simulator not to focus the richtextfields.
The Builder suitable for call is super (Field.FOCUSABLE), and that fixed the issue.
Now, I have another problem. Suddenly, I added a few images, the background (they are all less than 300 KB) tested on simulators of 9000 and 8520, it worked.
When I test it on the 9700, it says net.rim.device.api.system.Application not found
Hint anyone?
-
Referring to the value of a text field, not the legend
How to refer to the value in a text field to make the data entered by the user "BOLD" / no fat without the caption of a field text in bold or not bold?
Hello
Two lines should do. The first turn the caption and the "BOLD" value, then the second changes the legend of back to normal:
TextField1.font.weight = "bold"; TextField1.caption.font.weight = "normal";
Hope that helps,
Niall
-
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};
-
Custom edit field - not drawing while typing of the text
I created a custom edit field (code below), but there is no slider or text drawn while typing.
The text appears if you click another field on the screen, but not while typing. I guess it has something to do with my method of painting, but I don't know?
Tips for making more effective methos painting would be a bonus!
Thank you!
import net.rim.device.api.system.Display; import net.rim.device.api.ui.Font; import net.rim.device.api.ui.FontFamily; import net.rim.device.api.ui.Graphics; import net.rim.device.api.ui.component.EditField; public class CustomTextField2 extends EditField { private int fieldWidth; private int fieldHeight; private int button_colour = 0xF9F9F9; private int text_colour = 0x666666; private int border_color = 0xCCCCCC; private Graphics graphics = null; public CustomTextField2(long arg0) { super(arg0); fieldWidth = Display.getWidth()-100; //int off = 8; FontFamily fFam = null; try { fFam = FontFamily.forName("SomeFontHere"); } catch (ClassNotFoundException e) { e.printStackTrace(); } Font font = fFam.getFont(Font.PLAIN, 20); Font defaultFont = font; int off = 8; fieldHeight = defaultFont.getHeight() + off + 10; this.setPadding(5, 20, 5, 20); } protected void paint(Graphics graphics) { graphics.setColor(button_colour); graphics.fillRect(0, 0, fieldWidth, fieldHeight); graphics.setColor(border_color); graphics.drawRect(0, 0, fieldWidth, fieldHeight); graphics.setColor(text_colour); graphics.drawText(this.getText(),20,10/2); super.paint(this.graphics); } protected void onFocus(int direction) { button_colour = 0xF9F9F9; text_colour = 0x666666; border_color = 0x3598CC; this.invalidate(); } protected void onUnfocus() { button_colour = 0xF9F9F9; text_colour = 0x666666; border_color = 0xCCCCCC; this.invalidate(); } protected void drawFocus(Graphics graphics, boolean on) { super.drawFocus(graphics, on); } protected void fieldChangeNotify(int context) { try { this.getChangeListener().fieldChanged(this, context); } catch (Exception e){ } } public int getPreferredHeight() { return fieldHeight; } public int getPreferredWidth() { return fieldWidth; } protected void layout(int arg0, int arg1) { setExtent(getPreferredWidth(), getPreferredHeight()); } }
I just posted a code in another thread - he does most, if not all, of what you want. Take a look:
Maybe you are looking for
-
TECRA A3 - started as disconnected connected LAN cable
Hello because I got my TECRA A3-152, I experience the network at startup card does not recognize the network cable. The cable network is reported as disconnected. Only after manual toggle the NIC is recognized the cable and network card works fine. O
-
in a clear stamp series Module Touch Panel
I use LabVIEW Touch Panel Module make an app on a touch device with Windows CE 5.0. Now, I want to use RS232 touch panel devices to read and write. I use Serial compatibility VIs.It is useful, but it does not offer how to clear buffer rs232, as empty
-
New-VM: Specification of a static IP for the parameter - OSSpecification address
I am looking for a way to automate a large number of deployments of virtual machine using an array of IP addresses. First, however, I need to understand how to move the static IP setting in the property - OSCustomizationSpec. The customizations we
-
No pictures can be selected with DNG Converter to convert to DNG - what is the problem?
Since my LR4 cannot import my new 7 d MKII RAW data, I have tried to convert the RAWs with DNG Converter whixh should be the best option. Unfortunately, after the opening DNG Converter does not show the RAWs in the folder that I could choose for the