Openedge form - avoid the message Press space bar to continue - progress-4gl

I'm writing a program to accept input from the user. I display some background text in a frame, then use an overlay frame to prompt for input. In my simple example below I get the message "Press space bar to continue" before the prompt-for is run.
What can I do do skip seeing that message?
/* Background */
def var dLines as char format "x(78)" extent 20 no-undo.
dLines[1] = "Password:".
dLines[2] = "".
dLines[3] = "Scan/key password".
form
dLines[1] skip
dLines[2] skip
dLines[3]
with frame fLabel no-labels no-box row 1 column 1 screen-io.
display
dLines[1]
dLines[2]
dLines[3]
with frame fLabel screen-io.
/* Prompt for data */
def var dString as char no-undo.
form
dString format "x(60)"
with frame cPrompt14 overlay no-labels no-box row 1 column 12 screen-io.
/*** This is where I get the "Press space bar to continue" message ***/
prompt-for
dString
with frame cPrompt14.
assign dString.

You are prompted to press the space bar in CHUI when the view port is full. You can avoid this with PAUSE 0 BEFORE-HIDE NO-MESSAGE.

Related

autohotkey: getting characters of a string sent, while typing normally, to stay together

coloured_text:
send {^}%rand%
return
~t::
Random, rand, 1, 3
SetTimer, coloured_text, 500
return
~esc::
~enter::
SetTimer, coloured_text, Off
return
Code: When "t" is pressed the variable RAND gains a random number from 1-3. A label is then called 0.5 seconds later. This label sends the text "^%RAND%" i.e. ^1. The Label repeats every .5 seconds until enter/esc is hit. While all of this is happening though, as soon as I press "t", I am also manually typing sentences out i.e. "Big red dog".
So a good output might looks like: *"Bi^1g red ^3dog".
But sometimes I get somethin like: *"Bi^g1 red ^do3g".
In other words I need the label to send the two characters of "{^}%rand%" i.e. "^1" without breaks/gaps. And I need this to be done without interfering with my normal typing, whatever I may be typing. And I can't use any of the other sends (sendinput sendplay sendevent), just normal send.
That looks like color control codes of IRC, you can use something like this either via hotkey or hotstring.
It creates a small Gui with just an Edit so you can input the text you want colorized and when you press enter every 3 characters (configurable) get a random color.
If you still like your approach, you can take a look into BlockInput docs and wrap Send % "{^}" rand between them. Is reliable as long as you run the script with UI Access
F1::Colorize()
:*X:/color::Colorize()
Colorize()
{
Gui C:New, +LastFound -SysMenu
Gui Add, Edit, -WantReturn r5 w200
Gui Add, Button, Default Hidden x0 y0, OK
Gui Show,, Colored Text
}
CButtonOK()
{
GuiControlGet Line,, Edit1
Gui Destroy
Out := "", i := 0
loop parse, Line
{
if (A_LoopField = " ")
{
Out .= " "
continue
}
/* Every 3 characters
*/
if !Mod(i++, 3)
{
Random r, 1, 3
Out .= "{^}" r
}
Out .= A_LoopField
}
Send % Out
}
CGuiEscape()
{
Gui Destroy
ExitApp
}

Prevent word wrap in GUI text

I have a MATLAB GUI that allows a user to load a configuration file. I then want the filename to be displayed in a static text field. My problem is that the string is too long for my text field and wraps around. I want the text to display as much of the string as it can without wrapping, prioritizing the end of the string.
For example, if I have a filename 'C:\folders\more\folders\thisismylongfilename.txt', I am currently seeing
C:\folders\more\folders\thisism
ylongfilename.txt
If I use an edit text rather than a static text, I see C:\folders\more\folders\thisism
I would like my text field to display olders\thisismylongfilename.txt, or maybe ...ers\thisismylongfilename.txt. The missing portion can either be "displayed" but outside the visible box, or something I can remove before displaying. I would just need to know how much of the string to remove.
How can I properly display my long string in a fixed width text box?
One way to accomplish this would be read the length of your textbox and shorten the string before you display it.
myString = 'path/to/file/file.txt';
set(handles.textbox,'Units', 'Characters'); %set units to characters for convenience
pos = get(handles.textbox,'Position'); %get the position info
maxLength = floor(pos(3)); %extract the length of the box
if length(myString) > maxLength % cut beginning if string is too long
newStart = length(myString) - maxLength + 1;
displayString = myString(newStart:end);
else
displayString = myString;
end
set(handles.textbox,'String', displayString);

maskedEditColumn datagridview how to use class? is it what i need?

I am trying to mask user's input in a datagridview column and i found this ready class Masked edit column Class that adds a 'mask edit column' option in the column types list. When i select this column type a mask field is being added in the list of column properties. I tried to do my job by adding some mask elements in this 'Mask' field, but when I run the code it didnt restrict me from adding other characters. I re-opened the 'edit columns menu' and I saw that the 'Mask' field was empty.
I want the text cell to accept 20 chars maximum and only: 1.Capital Letters(English & Greek), 2.these three chars(.,-), 3.Numbers 0-9
So as a first test i used only this mask(>????????????????????) but it didnt work as it didnt convert my characters to Uppercase and accepted more than 20 chars when i end the cell edit.
i am not sure the way to go is the Masked Text Box way. i have made many projects on vb and i used to use a loop in the textChanged event of a text box to restrict characters entry. the loop is this : (but i cant use it now in the valueChanged event cause it seems that 'value' doesn't have a selectionStart property.)
Dim charactersDisallowed As String = "!##$%^&*()+=|}{][:;?/><.,~""
Dim theText As String = txtCopies.Text
Dim Letter As String
Dim SelectionIndex As Integer = txtCopies.SelectionStart
Dim Change As Integer
For x As Integer = 0 To txtCopies.Text.Length - 1
Letter = txtCopies.Text.Substring(x, 1)
If charactersDisallowed.Contains(Letter) Then
theText = theText.Replace(Letter, String.Empty)
Change = 1
End If
Next
txtCopies.Text = theText
txtCopies.Select(SelectionIndex - Change, 0)
So,
Is a masked text cell what i need? and if yes( Why is this mask box not keeping the mask i enter? And how can i use this class to do my job?)
What can i alternately do to restrict some characters in a column's cells? (I will then convert to Uppercase on cellEndEdit)
I finally did it by removing the unwanted characters on cellvaluechanged event, which seems that is being raised when I end the cell's edit by for example hitting "Enter".

Matlab - how to remove a line break when printing to screen?

There is for example a big big score
for 2 hours
and there is need to see how many more before the end of
do output on the screen of the outer loop
but the values ​​and there are many, such as 70 000
Question - how to remove a line break when printing to screen
not to receive 70 000 lines
and to see only the current display in one line?
Instead of using disp to display text to the screen, use fprintf, which requires you to enter line breaks manually.
Compare
>> disp('Hello, '), disp('World')
Hello,
World
with
>> fprintf('Hello, '), fprintf('World\n')
Hello, World
The \n at the end of 'World\n' signifies a line break (or newline as they're commonly called).
Try this function, which you can use in place of disp for a string argument. It displays to the command window, and remembers the message it has displayed. When you call it the next time, it first deletes the previous output from the command window (using ASCII backspace characters), then prints the new message.
In this way you only get to see the last message, and the command window doesn't fill up with old messages.
function teleprompt(s)
%TELEPROMPT prints to the command window, over-writing the last message
%
% TELEPROMPT(S)
% TELEPROMPT() % Terminate
%
% Input S is a string.
persistent lastMsg
if isempty(lastMsg)
lastMsg = '';
end
if nargin == 0
lastMsg = [];
fprintf('\n');
return
end
fprintf(repmat('\b', 1, numel(sprintf(lastMsg))));
fprintf(s);
lastMsg = s;

I am using Progress 4gl and trying to dynamically change a column-label, is this possible

I tried the below code :
def temp-table tt-dg1
field dtoday as date column-label "dg "
.
buffer tt-dg1:BUFFER-FIELD("dtoday"):
column-LABEL = buffer tt-dg1:BUFFER-FIELD("dtoday"):column-LABEL + "77".
display buffer tt-dg1:BUFFER-FIELD("dtoday"):column-LABEL.
create tt-dg1.
dtoday = today.
display tt-dg1 with frame f2.
Expecting field dtoday to now have a column-label of dg 77 but it's still dg, I need this to add week numbers to the standard column-labels of a spreadsheet I am creating.
Any help gratefully receieved :)
This feels like a fault.
It does not appear to work when overriding it on the temp-table.
If you define your field in a frame before display then you can overide it there.
form tt-dg1.dtoday with frame f2.
tt-dg1.dtoday:label = "MyLabel".
display tt-dg1.dtoday with frame f2.
That may or not help depending on what you are doing.
Is it possible to dynamically create the temp table? if so you can dynamically set it there
DEFINE VARIABLE ttDynTable AS HANDLE NO-UNDO.
DEFINE VARIABLE vInt AS INTEGER NO-UNDO INIT 77.
CREATE TEMP-TABLE ttDyntable.
ttDynTable:ADD-NEW-FIELD('dtoday', 'DATE', 0, "99/99/9999",?,"","dg " + STRING(vInt)).
ttDynTable:TEMP-TABLE-PREPARE("tt-dg1").
ttTTHandle = ttDyntable:DEFAULT-BUFFER-HANDLE.
ttTTHandle:BUFFER-CREATE.
ttTTHandle::dtoday = TODAY.
DISPLAY ttTTHandle:buffer-field('dtoday'):column-label ttTTHandle::dtoday.
if not you can just pull the column-label from the buffer instead
DEFINE TEMP-TABLE tt-dg1 FIELD dtoday AS DATE COLUMN-LABEL "dg ".
DEFINE VARIABLE vTTHandle AS HANDLE NO-UNDO.
CREATE tt-dg1.
dtoday = TODAY.
vTTHandle = BUFFER tt-dg1:HANDLE.
vTTHandle:BUFFER-FIELD("dtoday"):column-LABEL = vTTHandle:BUFFER-FIELD("dtoday"):column-LABEL + "77".
DISPLAY vTTHandle:BUFFER-FIELD('dtoday'):COLUMN-LABEL.