2d barcode scanner inconsistent behavior in Ubuntu 20.04 - barcode-scanner

I am using 2d barcode scanner ( Plug and Play ). This behaves inconsistently when used in any input field or text editor. e.g. Say I scan a barcode while my cursor is blinking in input field of Java swing application, sometimes the input from barcode gets printed in input field really quickly and sometimes I could see characters are getting printed in input field. There is a visible lag of ~second for each character.
This behavior is similar for text editor as well. Not sure how I can check this point. Is there any way to debug this point ?

Related

Changing part of text to a different color in an input

Am a newbee to javascript but have plenty of experience in VB, C, and even 86 assembler. Maybe I am trying to do the impossible in porting a VB app to js here. Basically, I need to change the color for only part of the string in an input element. Here is the problem:
A function takes an entered input box text field, and processes it first to see if it is in conformity to a set of requirements. If part of that string is not in conformity, I would like to in some way highlight that part in the input field. For instance, maybe I can send back the string to the input element (eg using the value attribute) but with some highlighting for that part, such as changing its text color or background color. Is this possible in js?
I'm not sure whether you can change colors of partial text in a simple text box. But what you're trying to do is certainly possible with this: https://editorjs.io/
The example on the homepage shows you how.
I hope this is a possibility for you and not too heavy for your purpose.

How to print barcode in Reports

can someone please guide me how we can print barcodes which upon scan should read the number hookup to it. we have tried with code39 which prints the barcode but scanner is not identifying the number hookup up to it, we also tried with code128 which show barcode with red cross lines.
Thanks.
If you can't scan, the problem is within the scanner not with the barcode. Scanners come with configuration procedures so you can configure the code the scanner will use.
In doubt I'd recommend to go with Code 128 as most scanner support both 39/128 and 128 has support for more special characters like '*'.
To use Acumatica report designer to generate the barcodes.
Place a PictureBox control in the report
Set Barcode->Source property to Barcode
Use Barcode->BarcodeType to select the code used and in Barcode->Value you can put a formula/field/constant for the barcode value.
As for the red cross lines, my guess is that your controls are overlapping. Check that your controls are not placed on top of each other in the report designer. Also if the barcode is too long to fit in the control size it will display red cross. Try making the control wider or reducing BarWidth property to make it fit in the picture control container.

PyQt QTextEdit text selection without moving the cursor (like ubuntu terminal)

I've developed a shell (imitating the ubuntu terminal --> can only edit text after current prompt) by a PyQt QTextEdit.
The thing is when I select some text, the cursor moves as I'm selecting this text (so it disappers from the current command line) and I would like the cursor to stay where it is (only when I select text because I want it to move when I move it programmatically by textEdit.moveCursor(...)) at the same time I'm selecting the text.
Does anybody have any idea of how could I do that?
My solution for now, is to save the position at any change of it (except when it changes by a click), and when I copy some text en paste it, it'll be automatically pasted in the last position the cursor was before the click. That works perfectly but it's "ugly" for the user because, as I said, when he selects the text the cursor disappears of the current line and is where the user is selecting the text. Not like in ubuntu terminal.
Thanks in advance! And sorry for my english.
Adri
I don't see an easy solution to implement this with a text editor API. A terminal is a hack, basically. It mixes a read-only element (anything above the current prompt) with a text editor.
My approach would be to create two text editors, make one read only and display the results of all operations there. If you hide the borders of the two editors, then it will look like a single one. You may have to forward a bunch of events (like scrolling with the keyboard) to the read-only display.

how to change the input mode of the mobile using j2me (MIDP2.0)?

I am working in j2me midp2.0 environment. Now, I want to draw String (custom item) based on user key pressed event. Here, my problem is, some phones default input mode is numeric and I can't be able to draw Strings. How to change this input mode to Strings and vice versa?
I think you manually get the key values and change it. On key press event you find which key pressed based on that you write a login to get numeric values or character, etc.

SetLimitText() in a CEdit in Vista does not work

This is happening on Vista.
I created a new dialog based MFC project to test this. I added a CEdit control to my dialog. I called SetLimitText to let my CEdit receive 100000 characters. I tried both:
this->m_cedit1.SetLimitText(100000);
UpdateData(FALSE);
and
static_cast<CEdit*>(GetDlgItem(IDC_EDIT1))->LimitText(100000);
I placed these calls on InitDialog.
after I paste 5461 characters into my CEdit, it becomes empty and unresponsive. Any ideas as to what is causing this and workarounds to be able to paste long strings of text in a CEdit or any other control?
note: 5461 is 0x1555 or 1010101010101 in binary, which i find quite odd.
if I paste 5460 characters I have no problems.
I contacted microsof support.
The goal was to have approximately
240000 characters in one single
editable line of text.
I am able to reproduce the issue on
Windows Vista (x64 and x32 both) but
not on Windows XP.
this code works fine in XP:
BOOL ClongeditXPDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
UINT limit = m_longEdit.GetLimitText();
m_longEdit.SetLimitText(240000);
UINT limit2 = m_longEdit.GetLimitText();
CString str;
str = _T("");
for(int i = 0; i < 250000; i++)
str += _T("a");
m_longEdit.SetWindowText(str);
return TRUE; // return TRUE unless you set the focus to a control
}
If I use a CRichEdit control instead,
when I press "end" key or "right
arrow" key after pasting a long string
inside, i cannot see all the
characters in the Rich Edit Control.
trying to scroll past the last visible
character produces a beep. The rest of
the characters are there, I know this
because if i double-click the Rich
Edit Control and copy the text using
ctrl-c and then paste it on a text
editor, I can see the 240000
characters. So the control is holding
the right amount of characters, but
the last characters are not viewable
except in an external editor, so my
original problem remains.
Here are the answers by microsoft
representatives:
Problem here is that an edit control
with a large number of characters in
it does not paint its text.
I tried setting different characters,
and discovered that I could fit more
'l's than 'x's than 'm's. The issue
isn't directly the number of
characters, but is likely the number
of pixels. Multiplying the number of
visible characters by the pixel width
of the characters in the selected font
shows that the limit is about 32k
pixels.
another answer from microsoft:
I did extensive research on this issue
and would like to update you about the
case progress.
The primary difference between the
Edit control on Vista and on XP is
that the Edit control on Vista
pre-composes its glyphs for better
international support (internally, it
ends up calling ExtTextOut with
ETO_GLYPH_INDEX and an array of glyphs
rather than a string of characters.
This ends up saving the glyph indices
into a metafile and so runs into the
32k pixel limit. When too many
characters are provided, ExtTextOut
fails and draws nothing. The Edit
control on XP doesn't precompose the
glyphs and so doesn't have this
problem, but won't handle
international characters as well.
The edit control on XP will clip at
32k, but since that is offscreen it
isn't obvious. When scrolling to the
right, it starts with the first
visible character so the visible part
of the control is always earlier than
32k pixels.
The RichEdit control draws the
beginning, but after hitting End,
edits occur mostly offscreen.
RichEdit 3.0 and 4.1 gives similar
behavior. This appears to be the 32k
pixel limit of RichEdit control, as
the it draws its text on an offscreen
bitmap before displaying it to the
screen.
Considering these points, the behavior
is by design. You would need to create
your own control to get the behavior
of displaying as big string as 240000
in a single line.
and the last one:
I did further research on this issue
for finding any light weight
workaround for overcoming 32k pixels
limit, but unfortunately it seems that
there is no workaround for this.
Couple of alternatives that we tried
are RichEdit 3.0, RichEdit
4.1, using UniScribe, using different fonts etc., but none of them seems to
suffice your requirement.
Possibly, you would need to create
your own custom control if you wish to
display an editable single-line string
which exceeds 32k pixel limit in
Windows Vista.
FYI -- if the text is read-only/dsiplay only, you can add some CR-LFs to the string to fix the display of the text. It appears that the ExtTextOut function works slightly different when the newlines. Since it is a single-line edit box the newlines are stripped so the text looks the same -- unless you copy and paste it, then the linefeeds will be in the string...

Resources