-
October 18th, 2005, 06:55 AM
#1
Want to set "ES_MULTILINE" property of Edit object externally
Hi,
I have One Edit Box on the dialog..
I want to set its property ES_MULTILINE throught the code.
I cannot change its properties straight way on dialog..
It has to be done through code..
Is there any option where I can create the Object and Subclass It to the Edit box on dialog?
I mean something like..
CEdit *My_Edit;
My_Edit->Create(...,....ES_MULTILINE,...,...);
and then subclass it with the Edit box I have on the dialog?
If this is possible then What should I put in CRect and nID and parent
parameters in Create method of CEdit?
-
October 18th, 2005, 07:00 AM
#2
Re: Want to set "ES_MULTILINE" property of Edit object externally
you can do it simply like
Code:
CEdit* pEdit = new CEdit; pEdit->Create(ES_MULTILINE | WS_CHILD |
WS_VISIBLE | WS_TABSTOP | WS_BORDER, CRect(10, 10, 100, 100),
this, 1);
or use ::SetWindowLong() to change the style of edit Control at run time
in your rect specify the size of your control and id what ever you wann you can take 1,2 etc
Last edited by humptydumpty; October 18th, 2005 at 07:02 AM.
-
October 18th, 2005, 07:09 AM
#3
Re: Want to set "ES_MULTILINE" property of Edit object externally
Originally Posted by humptydumpty
or use ::SetWindowLong() to change the style of edit Control at run time
You don't need to use SetWindowLong() for that - ModifyStyle() would be much easier.
However, ES_MULTILINE is one of those styles which can't be changed after the control has been created. To change it dynamically, you would need to destroy the control and create a new one with the ES_MULTILINE style set when you call Create().
-
June 15th, 2021, 04:29 AM
#4
Re: Want to set "ES_MULTILINE" property of Edit object externally
Originally Posted by gstercken
You don't need to use SetWindowLong() for that - ModifyStyle() would be much easier.
However, ES_MULTILINE is one of those styles which can't be changed after the control has been created. To change it dynamically, you would need to destroy the control and create a new one with the ES_MULTILINE style set when you call Create().
Where did you get that info? I don't see it anywhere in the documentation.
-
June 15th, 2021, 06:31 AM
#5
Re: Want to set "ES_MULTILINE" property of Edit object externally
Victor Nijegorodov
-
June 15th, 2021, 07:03 AM
#6
Re: Want to set "ES_MULTILINE" property of Edit object externally
I was talking specifically about this part:
Originally Posted by gstercken
However, ES_MULTILINE is one of those styles which can't be changed after the control has been created.
I had nowhere seen this stated.
-
June 15th, 2021, 07:48 AM
#7
Re: Want to set "ES_MULTILINE" property of Edit object externally
Originally Posted by sergiol
I was talking specifically about this part:
Originally Posted by gstercken
You don't need to use SetWindowLong() for that - ModifyStyle() would be much easier.
However, ES_MULTILINE is one of those styles which can't be changed after the control has been created. To change it dynamically, you would need to destroy the control and create a new one with the ES_MULTILINE style set when you call Create().
I had nowhere seen this stated.
Again: see the link I have posted! From https://docs.microsoft.com/en-us/win...control-styles
Edit Control Styles
05/31/2018
To create an edit control using the CreateWindow or CreateWindowEx function, specify the EDIT class, appropriate window style constants, and a combination of the following edit control styles. After the control has been created, these styles cannot be modified, except as noted.
...
ES_LOWERCASE
Converts all characters to lowercase as they are typed into the edit control.
To change this style after the control has been created, use SetWindowLong.
...
ES_NUMBER
Allows only digits to be entered into the edit control. Note that, even with this set, it is still possible to paste non-digits into the edit control.
To change this style after the control has been created, use SetWindowLong.
...
ES_OEMCONVERT
Converts text entered in the edit control. The text is converted from the Windows character set to the OEM character set and then back to the Windows character set. This ensures proper character conversion when the application calls the CharToOem function to convert a Windows string in the edit control to OEM characters. This style is most useful for edit controls that contain file names that will be used on file systems that do not support Unicode.
To change this style after the control has been created, use SetWindowLong.
...
ES_UPPERCASE
Converts all characters to uppercase as they are typed into the edit control.
To change this style after the control has been created, use SetWindowLong.
ES_WANTRETURN
Specifies that a carriage return be inserted when the user presses the ENTER key while entering text into a multiline edit control in a dialog box. If you do not specify this style, pressing the ENTER key has the same effect as pressing the dialog box's default push button. This style has no effect on a single-line edit control.
To change this style after the control has been created, use SetWindowLong.
As you can see the ES_MULTILINE style is NOT among those that can be changed with SetWindowLong after the control has been created.
Victor Nijegorodov
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|