I'm trying to modify an existing dialog based program written in C++ under Visual Studio.
The title bar on the dialog is showing centered text. I need that to be left justified. But I cannot figure out why it is centered in the first place. I've written another sample program and the title text is left justified by default. An option in the properties for the dialog is to Right Alight Text. That works in my sample program, but changing it in the existing program shows no effect.
It seems like someone must have gone to some effort to center the text, but I don't see anything in the code, and if fact, the centering (or right justifying in my sample/test program) shows up in the dialog editor. So it must be in the properties there. But where!?!?!
This is one of those things that just has to be easy and I'm not seeing it!
So how do I left justify that title text? I'd even be happy to do it in code, since I'm already modifying the title to add a program version number in there. BTW, when I add to the title, or swap in a new title, that text ends up centered.
The trick to make the text center is by overriding the WM_NCPAINT event as given in this link
If you don't want to make the text center, remove the override and it should work.
So this isn't really an answer, but my "problem" was that I was comparing programs running on Win10 and Win8. It turns out the default for Win10 must be to left justify titles while the default for Win8 is to Center.
Programmatically I'm tacking on a version number to a title, and the centering process in Win8 apparently is not dynamic, so the result is skewed to the right. My solution is to simply add the number of chars in the version number to the original title, and when I tack the version number on, I'll trim off those spaces.
WM_NCPAINT is probably the "right" answer, but perhaps too expensive in terms of time.
Related
I develop an application in Qt/C++ with Qt 5.12.12 on Windows 10.
I have some *.ui files including simple QLabel widgets to display text in Calibri font, with 16 points size.
Here is an example of what is displayed on screen when "tt" is present in a word:
This is only cosmetic issue, but I did not find anything on the web about this kind of issue. I really need to keep the Calibri font.
When I use Calibri font, 16 points, in Word or any other text editor, I do not see this issue. I am getting really crazy...
Can someone help me please ?
Maybe you find that it's actually a single character instead of two. It's called a ligature. If you don't like it, try deleting it and re-type the two Ts. But actually, typographists do that to make the font prettier, not uglier. So maybe it's something you may want to get used to and actually start liking.
There are a lot of other ligatures as well, not only for TT. Most of which I know are combinations with F:
You may not get ligatures in Word because the default seems to be "no ligatures". You can find it in the advanced text properties:
If someone wants to replace the German screnshot by an English one, please do so
I am working on building spellchecking functionality into my app which currently uses MFC's CHtmlEditCtrl control.
Is there a way of drawing one of those "red squiggly lines" that you see under spelling errors on the HTML control, underneath the word that I detect to be a spelling error?
The only way I can think of is to use the actual HTML to apply this style, and then strip it out upon the email being sent. This seems rather messy, as if the user starts applying underline styles to the text they could interfere with it.
Is there a way of doing this with drawing?
Thanks in advance.
The interface you want is IHTMLRenderStyle. You pass this, once filled in, to the AddSegment method of the of the IHighlightRenderingServices interface. Here's an example in (gasp) VB. I've done it in C++, years ago now though, and it worked nicely.
I'm trying to implement a custom widget in wxWidgets (version 2.8.12), essentially a modified single line wxTextCtrl. It takes a text input that consists of two sets of 8-digit hexadecimal numbers separated by a space, and I want the control to automatically handle that space. For example, if the user types 1-8 in twice (no press of the space bar required), the resulting contents of the text control should be:
12345678 12345678
If the user were to then place their cursor after the first '3' and backspace three times, that space should automatically adjust as they edit, resulting in:
45678123 45678
Essentially, the space should be completely transparent to the user.
I have this, for the most part, done. The code is a bit long to paste here, so here is a Gist:
https://gist.github.com/036c1a90f77521a8653c
There is one bug, however, that I can't seem to fix- upon typing the ninth digit, it automatically inserts the space, but the cursor ends up right after the space, right behind the ninth digit.
All attempts to use wxTextCtrl::SetInsertionPoint() and wxTextCtrl::SetInsertionPointEnd() have shown no success, so I've come here as a last resort in hopes that somebody can point out what I'm doing wrong.
To assist in testing this widget out, I've prepared a very quick and dirty application containing the widget:
https://gist.github.com/cf3219eb47e2bfe85b38
Or click here to download the code as a tarball:
https://gist.github.com/gists/cf3219eb47e2bfe85b38/download
Just run make to clean, compile, and run the code all at once. You'll need wxWidgets 2.8.12 installed to compile, of course.
Mostly every other facet of this widget works exactly as I want it to- it is just this one very large problem that is keeping this from working. There is, however, one tiny bug that I'm curious about, and though it isn't a major concern I'd like to fix it some time.
The space will be automatically handled even upon deleting characters, even if you delete a selection- however, if the selection that you delete ends on the ninth digit, it won't reformat the contents of the control after the deletion.
If anybody can pinpoint the cause of that it would be appreciated, but the insertion point problem is obviously my main concern.
Thanks to anybody willing to help, I tried to provide as much information and explanation as possible- if I missed anything, please let me know.
Generally speaking, it's difficult to modify the input handling of a native control as it behaves differently under different platforms. I don't know if you tested your code under all (or at least more than one) of them already but I fully expect you to find more problems.
Instead of trying to do it on your own, I'd recommend that you look at wxMaskedEdit proposed for the addition to wxWidgets itself. It's not final yet but there is a preliminary version already and I think it could work with 2.8 too (although it's developed with 2.9, of course).
I am writing a windows program (no mfc) and need to output a status line to the operator every few seconds or so. I tried using rich text boxes but after so many hours it seems to hang up. Does anybody have an suggestions on what I can use instead?
People mentioned that my buffers might have been exhausted. I thought I had planned for that. After I had about 1000 lines displayed I would take the first 500 and remove them using the select and cut options in rich text boxes. I still ran into the same problem.
This question appears relevant, and this one too. But they don't give any concrete recommendations for an alternative to rich text boxes.
You might try the Scintilla control (scintilla.org) which does not appear to have any hard limitations on text size. It has a permissive license. It is used by many text editors such as Notepad++, Notepad2, Code::Blocks, FlashDevelop. I haven't tried it personally but there from the documentation it looks easy to use it in a Windows API application. Of course, it might be overkill for your purposes.
If you keep appending to the text in the control every few seconds for hours then you are probably running into some memory constraint on the control or the process. I think you would have this problem with any control you choose given update frequence and how long you're running the program.
Have you considered implementing a simple circular buffer for the content of the text box? Say only keep the last hour's messages. You could maintain a separate log file for history if the operator needed to go back in time for hours.
I ended up writing my own control to do this, essentially duplicating the Output window in Visual Studio. It was a success, but it ended up being much more code than I thought it would be when I started - I insisted on features such as auto-scrolling when the cursor was on the last line, select/copy, bold text, etc. It was backed by a std::deque so I could limit the number of lines stored for the window.
Unfortunately the code belongs to a former employer so I can't share it here.
I've been playing around with SketchFlow from Microsoft and one thing that bothers me is that I cannot seem to find a window looking like sketch.
I would like it to have title bar and 3 "buttons" like all normal windows do (minimize, maximize, close buttons).
In Balsamiq Mockups this is very easy, however I don't see any kind of window-like sketches in SketchFlow.
I'm trying to mockup future desktop application.
You are correct that there isn't one built in. In SketchFlow you can easily make "component" screens that can be used multiple times. To create what you are looking for you could combine a sketch rectangle, with a couple of buttons and a textbox. You can select all of this content, right click it and make it into a component screen.
The MockupsLibrary also provides the mockups you are looking for. Once you've installed it, it'll appear in your assets as "ButtonWithIconMockup". You can select the "WindowMinimize", "WindowMaximize", and "WindowClose" for your IconImage attribute to get the desired result.
With Expression Blend 4, you can install the Mockup Controls by following the instructions at How to add mockup controls to your Expression Blend library. In the new Assets | Mockups category you will see a WindowMockup item that does exactly what you wanted.
To play around with the Mockup Controls, try the MockupDemonstration sample from the Help Welcome screen.
Unfortunately, there doesn't seem to be a builtin MenuStrip yet (although you can laboriously build one yourself from the non-sketchy SimpleMenu and SimpleMenuItem controls)? Also there doesn't seem to be any support for indicating keyboard accelerators (prefixing the desired letter with & doesn't work).
In general, it seems like Sketchflow really isn't designed to be used to prototype standard desktop applications?