How to save a string/character value in progress 4gl/openedge - character

in the trigger save button, i applied a syntax
field-name = CAPS(var).
my question is,how do i save set a specific word(s)/character/phrase in my field-name?
WORDS WORDS WORDS **iPHONE** WORDS WORDS WORDS

For Progress OpenEdge, there's two ways to change the field's screen value - either display something on the field, or set the field's "SCREEN-VALUE" attribute, like so:
DEFINE VARIABLE chField AS CHARACTER NO-UNDO.
DEFINE FRAME f-demo
chField FORMAT "X(10)"
WITH OVERLAY TITLE "Demo Frame".
ON VALUE-CHANGED OF chField
DO:
/* Moves data from the screen field to the variable */
ASSIGN chField.
/* Upper Case the field */
ASSIGN chField = CAPS(chField).
/* One way to change the screen value */
DISPLAY chField WITH FRAME f-demo.
/* Another way to change the screen value */
ASSIGN chField:SCREEN-VALUE = chField.
END.
/* Activate the input */
UPDATE chField WITH FRAME f-demo.
If this doesn't answer your question, you'll need to clarify what you're looking for.

Related

16X02 not giving any character in display

I want to display some string on 16X02 lcd. For the time being, I am implementing the example given in the following link. My 16X02 lcd's backlight is on and bright, but it is not giving any character as display. What should I do now?
https://www.losant.com/blog/how-to-connect-lcd-esp8266-nodemcu
#include <LiquidCrystal_I2C.h>
// Construct an LCD object and pass it the
// I2C address, width (in characters) and
// height (in characters). Depending on the
// Actual device, the IC2 address may change.
LiquidCrystal_I2C lcd(0x27, 16, 2); // my lcd pin address is different from the example
void setup() {
// The begin call takes the width and height. This
// Should match the number provided to the constructor.
Serial.begin(115200);
Serial.println ("In Setup");
lcd.begin(16,2);
lcd.init();
// Turn on the backlight.
lcd.backlight();
// Move the cursor characters to the right and
// zero characters down (line 1).
lcd.setCursor(5, 0);
// Print HELLO to the screen, starting at 5,0.
lcd.print("HELLO");
// Move the cursor to the next line and print
// WORLD.
lcd.setCursor(5, 1);
lcd.print("WORLD");
}
void loop() {
}
I'm assuming you are verified your physical connection and providing proper voltage supply.
Are you using the same I2C to GPIO expansion module PCF8574. If no the you may need to modify the LCD module.
Also verify if you have set the proper contrast voltage by adjusting the pot. You should first set it to value where by you can see all background dots (pixels); once text is visible you can set it to optimum value.

JavaFX - Label text color on negative text value

I would like to change text color of my Label in case its text value is a negative number (or starts with a '-'). Is there a proper binding to make it works?
No, you need to create it yourself, e.g.
Label label = ...
IntegerExpression value = ...
label.textProperty().bind(value.asString());
label.textFillProperty().bind(Bindings.when(value.lessThan(0))
.then(Color.RED)
.otherwise(Color.BLACK));
If you've don't have a expression that allows you to create a condition in this way you could of course also create a binding that depends on the Label's text property:
Label label = ...
label.textFillProperty().bind(Bindings.createObjectBinding(() -> label.getText().startsWith("-")
? Color.RED
: Color.BLACK,
label.textProperty()));

Output additional Text in Powermail if specific Checkbox is checked

so here's my problem: I tried to output an additional text once a specific checkbox is checked in powermail.
The select field contains multiple options and all are selectable of course, but when i.e. field 1 is checked the sender should have the standard text in the mail plus "Lorem ipsum", but when the field isn't checked there should be no additional output at all.
I could find a solution for altering texts depending on a selection for single selects / dropdowns and it works like a charm, but for a reason the multi-select doesn't work at all. I can't figure out why so maybe someone can help.
TS:
lib.serverex = CASE
lib.serverex {
key.data = GP:tx_powermail_pi1|field|produktang|1
key.intval = 1
1 = TEXT
1.value = Lorem Ipsum
#Default
default = TEXT
default.value =
}
The email in powermail looks like this:
Some standard text...
{f:cObject(typoscriptObjectPath:'lib.serverex', data:'{produktang}')}
The checkbox configuration inside the form (id: produktang):
first product | 1
second product | 2
third product | 3
fourth product | 4
fifth product | 5
Either it appends it no matter what the input is/checked boxes are or it doesn't send the additional text at all. I'm probably missing something here.
Thanks in advance!
The result of field {produktang} is an array (of course because it's a checkbox). So you have to find out if there is any key with value "2" (e.g. if you're searching for product 2) of in your case tx_powermail_pi1|field|produktang|1 == 2
I solved it now with kind of a trick because I couldn't make it work in a different way.
What I did:
I moved the specific product where the email alters to the first position in the multiselect element. So it's Index will be 0.
The next thing is to check if the element in position 0 of the array equals the desired product, in my case it's "firstProduct". Since it's in the first position it'll always be "firstProduct" if "firstProduct" is checked and the additional text will be "printed". I set the default text to an empty string so it'll stay blank in every other case.
Here's the code:
lib.serverex = CASE
lib.serverex {
key.data = GP:tx_powermail_pi1|field|produkt|0
firstProduct = TEXT
firstProduct.value = Lorem Ipsum
#Default
default = TEXT
default.value =
}
The configuration of the Checkbox inside powermail:
firstProduct
secondProduct
thirdProduct
fourthProduct
fifthProduct
And the code which is inside of the email itself:
{f:cObject(typoscriptObjectPath:'lib.serverex', data:'{produkt}')}
It probably works in another way as well, but I couldn't solve it another way. Hope this helps if someone encounters the same issues I had.

Removing x number of characters from the caret position in tinyMCE

I am working on a project where the user can enter a special character and then tab to auto complete the values. This part is mostly working, but I want to be able to delete x number of characters from before the caret position.
E.g. if | is the caret and I have the following text #chr|.
I want to be able to delete 3 characters before the cursor position, e.g. I would just end up with #.
I have found a way to get the current cursor position using the below code, but I haven't been able to find any way of being able to delete x number of characters from that position.
function getCaretPosition()
{
var ed = tinyMCE.get('txtComment'); // get editor instance
var range = ed.selection.getRng().startOffset; // get range
return range;
}
You can do this by creating a Range ending at the current caret position:
var ed = tinyMCE.get("mce_0"); // get editor instance
var editorRange = ed.selection.getRng(); // get range object for the current caret position
var node = editorRange.commonAncestorContainer; // relative node to the selection
range = document.createRange(); // create a new range object for the deletion
range.selectNodeContents(node);
range.setStart(node, editorRange.endOffset - 3); // current caret pos - 3
range.setEnd(node, editorRange.endOffset); // current caret pos
range.deleteContents();
ed.focus(); // brings focus back to the editor
To use the demo, position the caret somewhere in the text and then click the "Remove 3" button at the top to delete the preceding 3 characters.
Note that my demo is simplified and doesn't do any bounds checking.
Demo: http://codepen.io/anon/pen/dWVWYM?editors=0010
Compatibility is IE9+

Setting up some properties for a combobox (scroll, edit, jump)

There are 3 properties that I want to set for some VBA form comboboxes and I don't know if it's possible.
I don't want to let the combobox editable. Right now if the user types something in it that it submits the form it will send that value... I want to let him choose only from the values I added in the Combobox.
I want to make the list of items in the combobox scroll-able. Right now I'm able to scroll through the list if I use the scroll-bar but I don't know why I can't scroll with the mouse scroll.
And I want to jump to some item if I start typing. Let's say I have the months of the year in one combobox... if I start to type mar I want it to jump to march. I know that for the html forms this properties is by default but I don't know about VBA forms...
Thanks a lot
Of the behaviours you want, some are possible with settings on the Combo, others you will need to code
List of Months: Put a list of entries on a (hidden) sheet and name the range. Set .RowSource to that range
Match as you type: Set properties .MatchEntry = fmMatchEntryComplete and .MatchRequired = True
Reject non list entries: A Combo with these settings will allow you to type an invalid entry, but will reject it with an error message popup when you commit. If you want to silently reject invalid data as you type, you will need to code it.
If you want the selected value returned to a sheet, set .ControlSource to a cell address (preferable a named range)
By "...scroll with the mouse scroll..." I assume you mean the mouse wheel. Unfortunatley Forms don't support mouse wheel scroll. You will have to code it yourself. There is a Microsoft patch for this at here (not tried it myself yet)
Sample code to silently reject invalid entries
Private Sub cmbMonth_Change()
Static idx As Long
Dim Match As Boolean
Dim i As Long
If cmbMonth.Value = "" Then Exit Sub
If idx = 0 Then idx = 1
i = idx
Match = False
For i = 0 To cmbMonth.ListCount
If cmbMonth.List((i + idx - 1) Mod cmbMonth.ListCount) Like cmbMonth.Value & "*" Then
cmbMonth.ListIndex = (i + idx - 1) Mod cmbMonth.ListCount
Match = True
Exit For
End If
Next
If Not Match Then
cmbMonth.Value = Left(cmbMonth.Value, Len(cmbMonth.Value) - 1)
End If
End Sub
Set the propertie MatchEntry of combobox to 1 (fmMatchEntryComplete) and MatchRequired to true for example
combobox1.MatchEntry=1
combobox1.MatchRequired=True
[]'s