I am working with a tRichEdit component and using a tSpinedit to determine tab spacings using the trichedit.oncreate event to generate an array of tab positions to begin with. This is working fine and each new paragraph I generate uses the defined tab spacing. However, when using the SpinEdit1 Change event, I can change the tab spacing for the paragraph of text in which the cursor is placed, but it is not performing across the whole richedit text.
Is there a way to apply new tabstop settings across all of the paragraphs in a richedit document?
When I change the tab settings using tForm1.SpinEdit1Change, the tabs change for the current paragraph and subsequent ones, but previous paragraphs remain as they were. Is there a way to iterate through the paragraphs in the richedit1 content to change all of them in a 'for' loop? I have not found any array or list in the properties. Is there a property for setting the tabs globally at runtime or another approach that will accomplish this?
Select all paragraphs (from the very beginning to the end of the document) before setting the tab positions. You can select all paragraphs either manually, or programmatically with
RichEdit1.SelectAll;
Ref. documentation:
Vcl.ComCtrls.TCustomRichEdit.Paragraph
Paragraph formatting information includes alignment, indentation,
numbering, and tabs.
Paragraph is a read-only property, because a TCustomRichEdit object
has only one TParaAttributes object, which cannot be changed. The
attributes of the current paragraphs, however, can be changed, by
setting the properties of the TParaAttributes object.
The current paragraphs are the paragraphs that contain the selected
text. If no text is selected, the current paragraph is the one
containing the cursor.
Related
In a Firemonkey project, I have a TListBox with numerous items. Depending on the state of any given item, I intend to show the Detail as either red or white (on a black background). Of course I need to use the styles to do this.
I right-click one of the TListBoxItem controls and choose "Edit Custom Style...". It's my understanding that it's supposed to produce a new copy of whatever the current style lookup is just for this one control. In my case, I had already set it to listboxitemrightdetail prior to trying to customize it. What I would expect is that when I make a change to the font color in this style and "Apply and Close", that one single list box item should get that change.
However, instead of that one, ALL of the items in this list box got that change. The change I made actually modified the listboxitemrightdetail rather than producing a copy of it just for that one control.
In the end, I intend to have two style lookups, for example listboxitemreddetail and listboxitemwhitedetail which I can toggle on each list item in runtime.
What am I doing wrong, and what's the appropriate way to duplicate a style lookup to have two different versions?
Say I have a dialog box like this:
and I want to focus on title, then body and then each button one after another. I am able to focus on body using
UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, dialog.bodyLabel);
but is there any way to define a set of elements we want to focus instead of a single one?
EDIT:
I have also tried to make a list of elements I want to focus on using this syntax:
dialog.accessibilityElements = #[dialog.titleLable, dialog.bodyLable, etc];
but it just reads the first element (in this case dialog.titleLable) and doesn't move to the next one. Any thoughts?
The default value is set to NO for all the elements.
set the isAccessibleElement to YES for the all individual elements in the dialog
and then you can do
dialog.accessibilityElements = #[dialog.titleLable, dialog.bodyLable];
so that voice over reads title label first and body label next.
I am writing an iPhone/iPad application that requires simple word processing capabilities. I'd like to give users the option to add styles to the current paragraph. For example:
Type several paragraphs into the UITextView
Put the cursor in the middle of the second paragraph
Press a button that says "center" or "ordered list" or something
The entire paragraph takes on that style
After reading through the documentation I can't figure out a way to do this without starting at the cursor, reading backwards to a line break, then reading forwards to the next line break, and recording that as the range. Then style the attributedText property. Is that the only way to do this?
I've customised the style of a Firmeonkey list box item in such a way that now it can consist of 4 TLables in it. Each of the lable has Alignment as alNone.
I'm setting position of each of them in my code whenever i need to add any item. I've observed that when my list has scroll bar and if first component is not visible (i.e. i've scrolled down enough) at that time if i re-add all the items again in list box, then the position of TLabels in first items (or items which are not shown) get distorted.
For setting positions I am using below code :
(tmpListBoxItem.FindStyleResource('txtCol2') As TLabel).Position.X :=
(tmpListBoxItem.FindStyleResource('txtCol2') As TLabel).Position.X + (tmpListBoxItem.FindStyleResource('txtCol2') As TLabel).Width;
Any suggesstions, how can i overcome this issue.
Regards,
Padam Jain
Firemonkey styles are repeatedly 'applied' and 'freed' as components appear and disappear from screen.
It is not enough to simply set properties of style objects once and expect those values to be remembered. What you need to do is either listen to the OnApplyStyleLookup event or override the ApplyStyle method of a custom component and use the same you have above to set the properties again.
This means you'll need somewhere to store the values you are going to set.
I would suggest for your situation that you subclass TListBoxItem so you can add suitable properties or fields and put your code in ApplyStyle.
I'm working with a PowerPoint document which annoyingly sets all newly inserted text boxes' color to Red and uses Century Gothic. I believe this is due to the Master Slide being used by the document.
I would like to remove this automatic setting from text boxes in the Master Slide but I cannot figure out how?
I have gone into the Master Slide view and found that there are no text physical text boxes, there are however "Text Placeholders" but no text boxes. I find it strange and wonder:
how are these newly inserted text boxes contain pre-set font type and color?
If you aren't trying to do this in code, StackOverflow isn't really the right place for the question; you want SuperUser for "How do I ..." questions that don't involve code.
But what you want to do is select a text box that's formatted the way you want default text to be, then right click it and choose Set As Default Text Box. You won't get that option if you've clicked WITHIN the text box and have an insertion cursor; in that case press ESC, then rightclick.
If you're trying to do this in code, select a text box formatted to taste then do something like this:
Sub SetMeAsDefault()
Dim oSh As Shape
Set oSh = ActiveWindow.Selection.ShapeRange(1)
With oSh
.SetShapesDefaultProperties
End With
End Sub
The shape and text box defaults are independent of master formatting, which controls only the formatting of placeholders and text within placeholders. Text/shapes inserted via the Insert ribbon/menu follow the defaults set for the presentation as I've described above. Each presentation (and template) can have its own set of defaults.