I have an a few issues with the TMemo in iOS / firemonkey, One issue it seems some text is hidden (bottom paragraph) until user start drag/scroll. (However, the visible area in TMemo could hold nearly all the text if it wanted. But it first draws when user issues scroll.)
I have tried call SetFocus to trigger the same effect like drag/scroll, but no luck.
Underneath are some screenshots:
First how it looks like when broken (see bottom):
Then how it looks like when the memo redraws itself after a tiny drag:
As can be seen, the memo has not actually been scrolled/dragged in image two, but the initiation of of the operation was enough to make the memo draw its text correctly.
I can add that it always happens if the memoy has shown other text string earlier. (I suspect it may be some weird internal formatting/draw issue.)
Related
Is it possible to make TMemo show partially visible lines? I'm looking for a native way to do that, without custom rendering.
I made an example screenshot for those who not familiar with this issue:
As you can see,, in the area I marked with red, there is enough space to display some part of the next line that is not visible by default.
There are some components, like TListBox, which show partially visible lines, so I want to make TMemo do the same.
P.S. I'm not interested in other suggestions, like enlarging the TMemo size, that's off-topic.
It's not possible to make a TMemo to show partial lines. For what you can do natively to a memo, which is a multiline edit control, see edit controls on MSDN.
You could use a TRichEdit instead.
You can access the Lines and Text properties, just like for a TMemo. It also has the WordWrap, ReadOnly and ScrollBars properties, just like TMemo, so it could be a drop-in replacement, but showing partial lines at the bottom as required.
Tested in Delphi 10.1 Berlin as well.
Starting with a blank mobile app, I added a TlistView, a TCircle, and a TMemo. None of the controls had any alignment other than the default and they are all direct children of the main form.
In the OnPaint event of the ListView, I put this:
Memo1.Lines.Add('ListView paint'),
For the circle OnPaint:
Memo1.Lines.Add('Circle paint');
When I ran the app the results were that scrolling the listview resulted in lots of "Listview paint" and "Circle paint" getting added to the memo, both items always getting added at the same time. Why does scrolling a listview (or scrolling the memo) call an entire form repaint?
There's a line in the call stack that makes me think the entire form is getting repainted:
Fmx.Platform.Ios.TFMXView3D.drawRect(0x14659ec0,{origin = {x = 0, y = 0}, size = {width = 768, height = 1024}})
I'm want to know if this is supposed to be happening or not. This is causing poor performance in a listivew I have because a chart is constantly getting repainted.
Judging by the comments this appears to be a issue with Firemonkey, however it has been specified as by design. From the QC issue
GPU Canvas in FireMonkey that is used on mobile platforms always repaints the entire form, which is by design.
As a workaround, there is TRasterEffect, which can be dropped on the form and parented to one of the controls. If done so, the control will be rendered to internal image first and then such image will be drawn, alleviating the problem.
I have a Label and a Progess Indicator in my Vaadin indicator. It is dynamically made visible in the UI. There is a Tree below this Progress Indicator.
When the program dynamically sets the visibility of the Progress Indicator to true, the tree shifts down and the UI shakes due to the shifting.
Is there any way to make a Vaadin component occupy it's space, even if it is invisible and hence, when made visible it must not try to borrow space from other UI components?
What I am looking for is a feature similar to setRendered(true) in flex and actionscript programming.
Thanks for your help.
Finally I got an answer to my question. I just replaced the invisible components with a dummy visible label with no text.
And used it alternatively to switch between visible and invisible.
I asked the question in the Vaadin forum, and here's the response I got, from Kim Leppanen:
With Vaadin 7, if you set a component's visibility to false, then the component's information is not sent to the browser at all - it is just as if the component wouldn't exist in the layout at all.
I can quickly come up with two solutions. If you know the size of the component whose visibility you want to toggle, then you can use placeholder components - such as a Label. Put a label with the correct size in the place where you want the component. When you want to set a component as visible, then replace the label with the actual component.
The second option is to use css. Apply the css attribute "visibility: hidden" for the component you want to hide. Note that the component is not "truly" hidden. Let's say that it is a button. A user could still inspect the DOM tree and see the button in the code, change the visibility of the component on the client side (eg using developer tools or firebug) and then see and use the button as if it would be visible in the layout.
I am putting it here because people might add some more useful answers there. For a detailed explanation please see this.
Use this following example to the component you want set invisible but keeping its occupied space:
Image home = new Image();
home.setSource(HOME);
home.addStyleName("visibility: hidden");
OR
home.addStyleName("visibility: collapse");
There seems to be not much information available about this subject so hopefully someone can give some suggestions.
I would like to change color and style of different parts of text in a stringgrid cell.
Example:
20-02-2011 - Document Title
Would it also be possible to show an icon in a stringgrid cell?
It is indeed possible to show icons or bitmaps in a string grid, the Monkey Styler blog includes an example of how to customise cell display in a FMX grid.
http://monkeystyler.com/blog/entry/firemonkey-grid-basics-custom-cells-and-columns
Thinking about the other part of your question though, you will have to build a style up to display text in different fonts, as yet FMX does not have a richtext equivalent or HTML rendering components (I'm sure the latter will come, the former I am not confident on getting for a while!). You would have to have a text component in the style for each different font size/style etc, you would need to name the text elements (using binding or stylename properties) and handle the setting of the text contents using code in the ongetvalue and onsetvalue events (I guess you could also use a onapplystyle event) to display some text in bold and some not.
The event handler would then use either a binding - which is easier to set but - in my experience - buggy;
mycell.binding['boldtext']:='sometext';
Or find a style element by stylename by using findstyleresource;
tempobj:=mycell.findstyleresource('boldtext');
if tempobj is ttext then
ttext(tempobj).text='sometext';
Excuse any bad coding style there, but you get the general idea (I hope) if you set autosize to true for the ttext components in the style and align them left you get - mostly - what you are after. The only issue is that the resulting text doesn't look quite seamless because autosizing and aligning left doesn't really give you the same space between the fonts that you would get with a richtext or HTML display. You should be able to fiddle with the padding (giving it a negative number for the left padding should allow you to remove any extra space) but you have to live with that not being entirely perfect compared to proper font hinting and alignment.
My issue is with the thing Delphi progies scare to death - Rich Edit in Windows (XP and pre-XP versions).
Situation:
I have added EM_AUTOURLDETECTION in OnCreate of form. Target -> RichEdit1. Then, I have form, that is "collapsed" after showing form. RichEdit Control is sattic, visible and enabled, but it is "hidden" because form window is collapsed.
I can expand and collapse form, using Button1 and changing forms Constraints and Size properties.
After first time I expand form, the URL inside RichEdit1 control is highlighted. But, after second, third, fourth, etc... times I collapse and expand form, the RichEdit1 Control does not highlight URL anymore.
I have tried EM_SETTEXTMODE messages, also WM_UPDATEUISTATE, also basic WM_TEXT message -> no luck. It sems like this merssage really works ( enables detection ) while sending keyboard strokes ( virtual keycodes ), but not when text has been modified.
Also - I am thinking to rewrite code to make RichEdit Control dynamic. Would this fix the problem?
Maybe solution is to override OnPaint / OnDraw method to avoid highlight ( formatting ) losing when collapsing or expanding form?
Weird is that my Embarcadero Documentation says this function must work in any moment text has been modified. Why it does not work?
Any help appreciated. I am making this Community Wiki because this is common problem and togewther we cam find solution, right? :)
Also - follow-ups and related Question:
Override OnPaint
How to autodetect urls in RichEdit 2.0?
http://www.vbforums.com/archive/index.php/t-59959.html
I am not sure but is the window of the richedit recreated when geing from hide to show? If this is the case you might create your own derived TRichEdit class, override the function that creates the WIndows Handle (TWinControl.CreateHandle) and add EM_AUTOURLDETECTION there.