In a winAPI project, I am generating dialog templates at compile time, but not setting the positions and sizes of the controls until runtime because they depend on the font, which I set to whatever the user has set as their lfMessageFont at runtime. One of the dialogs has an up-down control with a static control set as its buddy window. For the sake of consistency, I would like the up-down control to be positioned and sized according to the standards of the UDS_ALIGNRIGHT style. However, it seems that setting that style only suffices to position the up-down control according to the position and size of the buddy window as specified in the dialog template, and when I resize the buddy window when handling the dialog's WM_INITDIALOG message, the up-down control doesn't change with it. Is there a way to manually invoke the UDS_ALIGNRIGHT code again at this point? Or do I need to switch to generating the entire dialog template at runtime if I want to keep the effects of that style?
If you are adjusting size and position at run time, then you need to re-measure each control according to the new values that affect it. You also need to check any option settings on each control that may affect the layout. In your case the setting for UDS_ALIGNRIGHT will affect the control it is set on (the up/down) and the buddy window. See Up-Down Control Styles (CommCtrl.h) - Win32 apps | Microsoft Docs[^] for further information.
You could load the resource dialog into memory and change the font details at runtime, and then invoke the dialog from the memory template. I am not 100% sure if that will work but a quick test should confirm it.
Inserting the font details into the template would save me having to send WM_SETFONT to every control in the dialog that has text while handling WM_INITDIALOG, as I do now, but I don't see what difference it would make in positioning the controls. One of the tools I use to determine the layout is Button_GetIdealSize, which I Can't call until I have an HWND for each control in question. As far as I can tell, that means I can't do it until I've instantiated an instance of the dialog. I guess I could instantiate an instance at startup, position and size the controls, alter the template to reflect the siz and position values this yields, then destroy the dialog. That way, each time an instance of the dialog is instantiated from then on, the layout will already be correct from the start. It seems like a rather tortured usage of the API, though.
I'm not sure what you mean by remeasuring each control. Out of context, I'd have guessed that would mean calling GetWindowRect on each control, but I believe I know what values that would return a priori; it should zero out the struct if I do it before reformatting the control, reflecting the zeroed-out dialog template, and if I do it after reformatting, it should return the values I just specified. I'm similarly confused about what it means to check the control's option settings.
I'm working on a project that involves an LL(k) parsing algorithm (or more accurately, a set of algorithms) which seem to be the best kept secret on the Internet.
The hunt for how to implement these took me back to C code written in 1989 and some citations for research papers dating back to 1992, which I can't seem to find a copy of the journal it was published in.
How do people even do LL(k)? How do they learn it? I understand how Terrence Parr (author of ANTLR) did as he has been instrumental in the crafting of LL(k) parsing algorithms for decades. He's no Aho & Ullman but he's a key player. He's the one that wrote that 1989 code I'm looking at.
I've found a few scattered research papers but the math is really heavy. You need a pretty advanced background in CS I think to understand it all.
But anyone else that wants to do this kind of thing? Good luck. If you can find the research it won't mean you can understand it, and I can't even find it, much less understand it. All the links are dead, and the citations I'm currently looking at lead to an out of print journal on information processing and information systems
It's ridiculous. No wonder there are so few implementations of this available (the major one by Terrence Parr himself)
I have used older projects with Greek characters in ANSI and code pages without problems.
Indeed unicode will solve the problem, but this specific project is too big and I have to make too many changes to finally make it work fine.
Anyway, I managed to fix the problem changing the title of the title dynamically inside the code.
Take in mind that when I recall strings from the Resource String Table using CString.LoadString(ID) I get gibberish but when I am using CStringW.LoadString(ID) it works. My String Table is not Unicode but inside VS2008 I set it up as Greek code page.
Two possible problems
1. In the project settings, make sure the character set is set to unicode for both debug and release
2. if you use third party libraries (other than MFC), make sure they also use unicode for both Debug and Release.
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
I can't see it either. It seems you've got two options, either use format_sed, if you know that you wont have \1 in the replacement string, or you'll have to turn any single $ into $$ before passing in to regex_replace There really should be a format_no_format flag to turn off format replacements.