I need simple editor. I use special symbols.
How redefine onPaint or other way what wxTextCtrl show line.
For example:
My special <a> line have := differen symbol
How showing '< a >' in green color and symbol := show a bold '=' (without ':')
ideal is runing this special showing in all lines without actual cursor. Whole document without actual line.
You can't override painting of wxTextCtrl (or of any other native control for that matter), nor would you want to do it. You can define "text styles" for the regions in it however, see the "wxTextCtrl Styles" section of the documentation which should be enough for what you want to do.
And if you need more than this, wxStyledTextCtrl could be helpful.
Related
In Sublime Text there's a way to highlight all similar strings by setting a cursor to every one of them, and then you can just type something, and this text will be printed in every highlight area. In rus version it's called "multicursor".
Is there something like that in CodeRush?
I know about "Replace all" function in Visual Studio. But this approach is not as convenient as the approach described earlier.
Something like that you can see in Rename feature of CodeRush.
Documentation:
When the Rename is activated, it turns all references to the selected
variable into the linked identifiers.
Linked identifiers are related sections that are kept synchronized. If
you change the text within one of them, all others get updated
accordingly.
There are also the Multi-Select feature which allows you to select separate text blocks by pressing CTRL + ALT + ENTER, but this feature does not allows you to edit every highlight area:
I have a QTextEdit and want the user to be able to type rich text which will then automatically be (correctly) shown in the widget (so: formatted).
It works fine when setting the text programmatically (using setText()), but not when manually typed. See picture below.. "Input" is set using setText, the following line is manually typed. I would like this line to automatically be formatted a
What's the (easiest) way to do this? The only way I can think about it to manually catch key events and explicitly set the text as HTML.. But I'm sure there's a better way.
Manual typed html gets escaped, the < will become a < etc . .
You wouldn't be able to edit it if that would not be the case, for obvious reasons.
You could try adding a [render] button or something like that to render the entered text to html. Trying to render on keypress is very dangerous because it makes it terribly inconvenient and counter-intuitive to type something and then have it magically change the output. Also un-finished markup will probably throw a stick in your wheel.
Also pasting from a rich text source (for example a webpage) keeps the formatting.
As "the JinX" already said it will not be so intuitive if you try to capture every key event and then try to change the text to render in HTML.
Though you can use some special key sequences, say "shift+return key" to change the text of current line/entire textedit to to html formatted one.
This is just a suggestion.
In this case more than implementation it is also about what a user will expect.
Changing the text of 1 line/entire textedit from plain to HTML would be easy to achieve as well.
I need a QTabWidget with icons only:
How can I hide the label text of a tab in Qt? I cannot set the text to an empty string (""), as I am using docked widgets ( QDockWidget ) and the label text is set automatically (and I need it if the widget is floating).
But in tabbed mode I just want to display the icons (of the tabs).
Possible approaches:
Font size to 0?
I need to create my own bar class and override the paint event as here
Anything easier / cleaner?
--- Edit ---
Ok, the "set window title to empty string, and reset it the original text" approach works. I am using the topLevelChanged signal for this. However, it has some drawbacks, as the empty text still occupies some space. Another issue, with the text the tooltip is gone, and I cannot set it back.
What I am currently trying is something in-between the "text empty" and Prasad Silva's approach. I try to identify the text label inside the tab and set its size to 0, then reset it. It's slightly different, but would keep the text intact.
Btw, I see a line on top of my tabs, any idea what this is (where it comes from)?
Edit: There seems to be no "easy way" (style sheet, attribute) for this, see Hiding bottom line in QTabBar
Maybe I will create the whole tab bar on my own, as the automatically generated stuff is just too hard to handle (agree with PS on this).
This can not be done easily. Use empty text.
The way I solved something like was to create a QDockWidget subclass that installed a QWidget subclass as the titlebar (via setTitleBarWidget). This gave me control over showing/hiding the text in the titlebar when the dock widget fires topLevelChanged, dockLocationChanged and visiblityChanged.
This is really a big hack to get around the fact that Qt has refused to expose a public API for the docking system. We have since moved on to a custom docking implementation due to these limitations.
If you do not want to see the text, you can set it to an empty text after saving the current text, and when you want to see it again, restore it from the stored variable.
I do not think there is anything in the API for this not so common case, which means you will need to do it yourself.
Now, you could claim that it is tedious to do for many widgets, but on the other hand, you could write a simple hash define or inline function to do this repetitive work for you, which would only result a one-liner call, basically, which you would need to use anyway when changing the state.
I am using C++ Builder to create a VCL forms application and am wanting a multiline editbox.
Am I correct in saying that I have to use a TRichEdit control to accomplish this?
If so, (and I have added one just to try out), how do I set the text in the control? There seems to be no .text or .caption property.
I can get the contents of the TRichEdit by the ->text property, but how do I 'set' the text?
Thanks
The Text property is read/write:
String s = RichEdit1->Text;
RichEdit1->Text = ...;
It is just declared as __published so you will not see it in the Object Inspector at design time. If you want to see the text at design time, you have to use the Lines property instead.
BTW, TRichEdit is not the only multi-line edit control. TMemo is another one. The main difference between them is that TRichEdit supports more formatting options than TMemo does. Think of them as the VCL equivalents of the MSWord and Notepad apps, respectively.
I'm programming using C++ and WinAPIs. I've added a system tray icon using Shell_NotifyIcon(NIM_ADD, ...) API. That icon also has an associated user prompt that contains an ampersand symbol in it, something like this, "View & Copy." But what a user sees though when the prompt pops up, is "View Copy". I tried doubling the ampersand, like so "View && Copy" but that didn't help.
Does anyone have any idea how to display an ampersand in a Windows tray prompt?
It's not a matter of escaping the ampersand - Windows by design will strip any ampersands from tooltip text, for a generally good reason:
Many applications create toolbars containing tools that correspond to
menu commands. For such tools, it is convenient for the tooltip
control to display the same text as the corresponding menu item. The
system automatically strips the ampersand (&) accelerator characters
from all strings passed to a tooltip control, and terminates the
string at the first tab character (\t), unless the control has the
TTS_NOPREFIX style.
As you can see, the answer is very easy: you just need to add TTS_NOPREFIX to the tooltip class and you'll be set.
Apparently, ampersands require double-escaping, like this &&&.
I'm not sure why but it seems to work.
My source: this link.