SetLimitText() in a CEdit in Vista does not work - visual-c++

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...

Related

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.

Weird results when trying to get UI elements to fit a dynamic size in Unity

I have a system where if you walk by a sign it will create a popup dialogue which is fine (just the popup part) but when I try to make it to where it can be adjusted based on how much text is displayed (Content Size Fitter) then I get something that literally does not make any sense to me whatsoever. When using World Space my font on Text components has to be 0 (also makes no sense) so that 1 letter isn't the size of 100 units and the combination of these 2 issues has almost made me go mad but that is the reason why I am here so you all can save me!
My setup for my sign :
Now this is the dialogue that is spawned viewed from the inspector (Not shown in the scene/game view yet) :
Now this is when the player walks near the sign with all the components you see in the screenshots :
As you can see the height of my dialoguePanel for some reason keeps going to 321 and New Years isn't close so this countdown I am not happy with. It should be adjusting to how much text is in it. I mean I just did a tooltip almost 100% identical except that the Canvas isn't World Space but Screen Space - Overlay. On top of all this it seems any text I use in World Space HAS to be font 0. Please help I am about to lose my mind.
World space canvas is a bit tricky. And guess what is even more tricky: content size fitter. One of solutions is that you add your dialog UI element manually in the scene at desired location and tweak its RectTransform values in inspector to get what you want to see in scene view and then save it as prefab.
Read more about How Content Size Fitter works and there is one more thing about UI when working with world space canvas. UI is way too bigger than your other scene elements. To solve this problem you have to scale it down as instructed in section Specify the size of the Canvas in the world.
Hope it helps :)

Labview: increasing the capacity of a text indicator

I have a (multiline) text indicator in my program where I display everything that my program does. Every time after adding new string to the indicator, I move the vertical scroll bar to the end to make sure that the user will see the message instantaneously. It works fine.
However, when there is a lot of text in the indicator, the user is unable to move the scroll bar. Also, the scroll bar doesn't move to the bottom of the indicator after adding a new message.
How can I increase the capacity of my text indicator? Is it even possible or do I have to decrease the amount of text I display?
The rest of the program works well, the screen doesn't freeze. The only problem I have is that the vertical scroll bar doesn't work properly.
LabVIEW stores strings as a pointer to a structure containing a 4-byte length value followed by a 1D array of byte integers (8-bit characters). The 4-byte value is the same size as a U32, which has a 2^32 range (0 to 4,294,967,295). So, your string can have up to 4,294,967,295 characters.
About the second part of your question: http://digital.ni.com/public.nsf/allkb/E888D1D6A739A787862571F800586482
Put a gigantic amount of text in your indicator while the VI is in edit mode. Can you move the scrollbar then? If you can, then I suspect the problem is how you're adjusting the scrollbar at run time. Is it possible that you're continuously setting the scroll position to the bottom so your user tries to drag it and fails?

Layout of text/spacing changes in TextArea when clicking on it

I have a CodenameOne application which has a TextArea that should display a multi-line text.
When I run the app in the simulator and click on the text-area, the spacing between the lines and possibly also between the characters change so that the area that the text occupies shrinks a bit.
Why is this?
What should I do to prevent it?
That is due to the switch from our drawing to the native editing which will always render things slightly differently. E.g. things like line spacing are really hard to get accurately for every native device.
TextArea has a setRowsGap method that allows you to specify the spacing between rows in pixels but since this differs between OS's its probably not ideal.

enlarge Excel dialog box for screen capture

I have to make a high resolution screen capture of part of an Excel session. I can zoom in on the contents of the spreadsheet, but the Sort dialog box I want to capture as well doesn't change size, so its pixel resolution doesn't increase.
Working on Windows 7, Excel Professional Plus 2010, screen 1280x1024 (max).
First look toward right-click blank area of desktop ► Screen resolution ► Make text and other items larger or smaller ► Larger - 150%. May require a reboot so be prepared to shut everything down.
If that is insufficient, next look toward the Windows 7 Magnifier utility. Hint: do not use Alt+PrntScrn to get your screen capture as it seems to collect a .BMP with less quality than a screen capture program's (e.g. Snipping Tool) .PNG capture.
When I went to turn on the magnifier I found a solution that works better for me than the magnifier. Under Control Panel -> Ease of Access -> Optimize Visual Display -> Change the size of text and icons I selected Larger - 150% and logged out and in. There's a little pixelation but it does what I need.
FWIW I don't understand the downvote to the question. Someone might think this is something I should have known.

Resources