I have been messing around with the Win32 api, and trying out new styles. Problem is, some styles cannot be changed at runtime. They DO get changed, but it doesn’t change anything. The only way for these to apply is to add the styles on the creation.
Is it possible to change the creation styles, just before the control is created? I tried subclassing and changing the style after the contructor fires, but it didn’t work.
It is possible to create the control on runtime, but that way I won’t have access to Xojo functions and properties.
Thank you in advance.
[quote=163676:@Ashot Khachatryan]I have been messing around with the Win32 api, and trying out new styles. Problem is, some styles cannot be changed at runtime. They DO get changed, but it doesn’t change anything. The only way for these to apply is to add the styles on the creation.
Is it possible to change the creation styles, just before the control is created? I tried subclassing and changing the style after the contructor fires, but it didn’t work.
It is possible to create the control on runtime, but that way I won’t have access to Xojo functions and properties.[/quote]
If you had specific examples, it would be easier to see what kind of things can be done.
Yeah you are right.
For example, changing some of the styles of the Edit control (which is the Xojo TextField) isn’t possible after the creation.
Quote from https://msdn.microsoft.com/en-us/library/windows/desktop/bb775464(v=vs.85).aspx
One of the styles I want to change is ES_MULTILINE.
Almost every multi-line textfield on other IDEs is based on the Edit control. Xojo’s Textarea is based on RichEdit control, and has a weird look. I suppose it is based on RichEdit to support both styled and un-styled text easily.
WFS has a method to make a button multiline, MultilineWFS that looks quite possible to adapt to a Textfield. It does work in the Open event of a PushButton to make it multiline.
It is interesting to note that the Msdn documentation indicates BS_Multiline is to be used with CreateWindow or CreateWindowEx just like for the TextField.
So maybe the same technique can be used for TextField ? I modified MultilineWFS to work with a TextField and experimented.
By googling, I found the value of ES_Multiline : &h04. It does not seem to do anything, though. Whereas other values do change, like 8 which makes the text uppercase, or the value originally in BS_Multiline of &h2000 which forces numeric entry only. Or maybe the value of ES_MULTILINE is wrong, but I could not figure where to find it on Msdn.
Edit : I finally found a list of API constants at http://www.autoitscript.com/forum/files/file/16-win32-api-constants/ top of the page click on Download.
ES_Multiline is in there and is indeed 4.
[quote=163700:@Michel Bujardet]WFS has a method to make a button multiline, MultilineWFS that looks quite possible to adapt to a Textfield. It does work in the Open event of a PushButton to make it multiline.
It is interesting to note that the Msdn documentation indicates BS_Multiline is to be used with CreateWindow or CreateWindowEx just like for the TextField.
So maybe the same technique can be used for TextField ? I modified MultilineWFS to work with a TextField and experimented.
By googling, I found the value of ES_Multiline : &h04. It does not seem to do anything, though. Whereas other values do change, like 8 which makes the text uppercase, or the value originally in BS_Multiline of &h2000 which forces numeric entry only. Or maybe the value of ES_MULTILINE is wrong, but I could not figure where to find it on Msdn.
Edit : I finally found a list of API constants at http://www.autoitscript.com/forum/files/file/16-win32-api-constants/ top of the page click on Download.
ES_Multiline is in there and is indeed 4.[/quote]
I actually use WFS as a reference and to learn the Win32 API.
I don’t have an issue with the constant of ES_MULTILINE, as I already have the hex of the style that works for a mutliline edit field. But that style HAS to be applied on creation, it doesn’t work if applied after creation. That’s my main issue. Xojo uses Create/CreateEx on the backend with a specific style. I just need to change that style (style is basically an integer…)
Thanks Michel
[quote=163748:@Ashot Khachatryan]I actually use WFS as a reference and to learn the Win32 API.
I don’t have an issue with the constant of ES_MULTILINE, as I already have the hex of the style that works for a mutliline edit field. But that style HAS to be applied on creation, it doesn’t work if applied after creation. That’s my main issue. Xojo uses Create/CreateEx on the backend with a specific style. I just need to change that style (style is basically an integer…)[/quote]
Unless there is some undocumented way of achieving it, I do not see how one could change the way a control is instantiated at the Win32 level. You could, however, design your own class based on Edit Control.