How to Change Appearance of Text in ChUI Editor Widget - openedge

I'm using an editor widget to display a longchar value read from a text file. OpenEdge 11.5 ChUI on Linux.
The logic is similar to the following:
def var mytext as longchar
init "Sample Text. Sample Text. Sample Text.".
form mytext view-as editor large inner-chars 30 inner-lines 15
scrollbar-horizontal scrollbar-vertical
with frame frame1 no-labels no-box.
view frame frame1.
display mytext with frame frame1.
mytext:read-only = yes.
enable mytext with frame frame1.
wait-for end-error of mytext.
When the editor is displayed, the text in the editor widget is "highlighted" (i.e., shown in reverse video). (See screenshot below.)
Is there a way to display the text in the editor widget so that it is not "highlighted"?

I usually do something like this:
/* textedit.p
*
* a file viewer
*
*/
define variable fileName as character no-undo format "x(30)".
define variable fileBody as longchar no-undo.
fileName = "textedit.p".
file-info:file-name = fileName.
if file-info:full-pathname = ? then
do:
message "no such file:" fileName.
pause.
quit.
end.
copy-lob from file file-info:full-pathname to fileBody.
display
fileBody view-as editor inner-chars 160 inner-lines 52 large no-word-wrap
with
no-box
no-labels
color display normal prompt normal /* this changes the coloring */
.
pause.
https://documentation.progress.com/output/ua/OpenEdge_latest/index.html#page/dvref/color-phrase.html
You can also fiddle with frame and widget attributes if you prefer that sort of thing.

Related

window form goes not responding stage

I am new to progress 4GL. In my program, I tried to create a form using progress 4GL. The form has two fields one is DB name and another one is DB Description. The scope of this form is by default this should have one DB name and description and if a user-entered or keep blank in the field of DB name then an alert box should give a message. I have developed the form but when I run it the program keeps continuously running and window form goes not responding stage. I don't get a chance to enter or keep blank to the DB field name. Let me share my code and please help to find out what is the issue and why it's continuously running.
define variable cArcDB as character no-undo format "x(20)" INIT "qadb".
define variable cArcDBDesc as character no-undo format "x(25)" INIT "archive database".
define variable cTmp as character NO-UNDO.
form
cArcDB colon 25
cArcDBDesc colon 25
with frame frArchiveDB width 80 side-labels.
MAIN-LOOP:
REPEAT:
display
cArcDB
cArcDBDesc
with frame frArchiveDB.
set
cArcDB
with frame frArchiveDB editing:
if frame-field = "cArcDB" then do:
/* Find next/prev record from ttAppDB */
cTmp = cArcDB:input-value in frame frArchiveDB.
display
cArcDB
cArcDBDesc
with frame frArchiveDB.
end.
end. /* editing */
cArcDB = trim(cArcDB).
if cArcDB = "" then do:
/* Blank not allowed */
/* {us/bbi/pxmsg.i &MSGNUM=40 &ERRORLEVEL=3} */
next-prompt cArcDB with frame frArchiveDB.
undo MAIN-LOOP,retry MAIN-LOOP.
end.
END.
Please have look at the online reference of the "EDITING phrase". To me it looks like you're missing the READKEY after the beginning of the EDITING block and you also need to "APPLY LASTKEY" at some point. See the sample there:
/* Update Customer fields, monitoring each keystroke during the UPDATE */
UPDATE Customer.Name Customer.Address Customer.City Customer.State SKIP
Customer.SalesRep HELP "Use the space bar to select a SalesRep"
WITH 2 COLUMNS EDITING: /* Read a keystroke */
READKEY.
/* If the cursor is in any field except SalesRep, execute the last key
pressed and go on to the next iteration of this EDITING phrase to check
the next key */
IF FRAME-FIELD <> "SalesRep" THEN DO:
APPLY LASTKEY.
IF GO-PENDING THEN LEAVE.
ELSE NEXT.
END.
/* When in the SalesRep field, if the last key pressed was the space bar
then cycle through the sales reps */
IF LASTKEY = KEYCODE(" ") THEN DO:
FIND NEXT SalesRep NO-ERROR.
IF NOT AVAILABLE SalesRep THEN FIND FIRST SalesRep.
DISPLAY SalesRep.SalesRep # Customer.SalesRep.
NEXT.
END.
/* If the user presses any one of a set of keys while in the SalesRep field,
immediately execute that key */
IF LOOKUP(KEYFUNCTION(LASTKEY),
"TAB,BACK-TAB,GO,RETURN,END-ERROR") > 0 THEN APPLY LASTKEY.
ELSE BELL.
END.

Fillable textboxes in PDF are not unique - all are duplicates of each other in the pdf, how to fix?

I am creating a report to send out to people and have them respond in the pdf with input in Adobe to save and send back to me.
I have managed to make text fields with hyperreff; however, the output pdf's textboxes duplicate eachother - so if I put "def" in one textbox - all the other textboxes in the document also put "def".
I am using:
\begin{Form} \TextField[width = 10cm, height = 3cm, multiline=true]{ } \end{Form}
which is used later in the document for user input:
\begin{Form} \TextField[width = 10cm, height = 3cm, multiline=true]{ } \end{Form}
You need to add a unique name to each field otherwise they all get the same name and then, in Acrobat, the same value when you edit one of them. See the name property below.
\begin{Form} \TextField[name = foo, width = 10cm, height = 3cm, multiline=true]{ } \end{Form}

How to add a window in wxpython other then parent frame and use information in sqlite query

I have a button in my parent frame(named as Add). I want to open a TextEntryDialog when user clicks that button,I want to open it like a pop up window.And i have to send that text typed by user back to parent frame, which i am going insert into my database table. It would be better if i can make a editable listctrl, in which i will have 4 columns and user will fill information into those columns and by sqlite query i will fill that information into database table.So how can i accomplish this?
First tutorial on the first page of a search for "wxpython text dialog"
https://pythonspot.com/en/wxpython-input-dialog/
You don't appear to have put in any effort whatsoever!
#!/usr/bin/python
import wx
def onButton(event):
print "Button pressed."
app = wx.App()
frame = wx.Frame(None, -1, 'win.py')
frame.SetDimensions(0,0,200,50)
# Create text input
dlg = wx.TextEntryDialog(frame, 'Enter some text','Text Entry')
dlg.SetValue("Default")
if dlg.ShowModal() == wx.ID_OK:
print('You entered: %s\n' % dlg.GetValue())
dlg.Destroy()

Create a separator with a text in the menubar

What I want is shown in the docs in the picture http://doc.qt.io/qt-4.8/qactiongroup.html#details, but I cannot figure out how to do it. I can create a separator by
QAction * separator = new QAction("This is ignored", actionGroup);
separator->setSeparator(true);
but then it is just a line. How is the "Alignment" text added to the action in the example?
Following your link, then to the "Menus" example link (where your example is excerpted from) and then to mainwindow.cpp (which is one of the source files for that example), I reach: http://doc.qt.io/qt-4.8/qt-mainwindows-menus-mainwindow-cpp.html
The last function in that source file is createMenus which contains the following:
formatMenu = editMenu->addMenu(tr("&Format"));
formatMenu->addAction(boldAct);
formatMenu->addAction(italicAct);
formatMenu->addSeparator()->setText(tr("Alignment"));
formatMenu->addAction(leftAlignAct);
formatMenu->addAction(rightAlignAct);
formatMenu->addAction(justifyAct);
formatMenu->addAction(centerAct);
formatMenu->addSeparator();
formatMenu->addAction(setLineSpacingAct);
formatMenu->addAction(setParagraphSpacingAct);
The important bit is the fourth line in: setText on the separator added by addSeparator()
This can be done using a QLabel with a QWidgetAction (e.g. in python):
label = QtGui.QLabel("<b>At least it is rich text!</b>")
label_action = QtGui.QWidgetAction(self)
label_action.setDefaultWidget(label)
menu.addAction(label_action)

How to deal with Auto Width property for labels in Reports Devexpress?

Am designing simple report in Devexpress. I add three labels continuously in xtrareport. 1st label & last label are set in designer screen but middle label data comes from database it may be (big or small) word or sentence. If data comes from database big means 3rd label get overlap with this data. How to solve this ?? Thanks in advance.
0. Three labels.
In report designer set the width of you 2nd label as more as possible:
Set the CanShrink, CanGrow, Multiline and WordWrap to true:
xrLabel2.CanShrink = true;
xrLabel2.CanGrow = true;
xrLabel2.Multiline = true;
xrLabel2.WordWrap = true;
In result you will get something like this:
1. One label with special format.
You can use one label with format string. Use {0} as placeholder for your data source values:
xrLabel1.DataBindings.Add(new XRBinding("Text", null, "Value", "Here is the text: «{0}». Here is the end."));
Also you can set the CanShrink, CanGrow, Multiline and WordWrap to true.
The result will be something like this:
2. One label with [brackets] in the labels's text.
You can insert a data field name with [brackets] into the control's text. For example:
xrLabel1.Text = "Here is the text: «[Value]». Here is the end."
And here is the result:

Resources