textbox

Started by paulDiagnos, November 10, 2004, 01:40:58 PM

Previous topic - Next topic

paulDiagnos

Hi is there any way to align text boxes

so i can type into a textbox and it is aligned in the  centre?

code for this would be of great help

TechSupport

Sure. Simply select the "ES_CENTER" style in the "WindowStyles" for the TextBox.

paulDiagnos

good lord thats all ?

been driving me mad

how can i do this in code? so i can change bits and bobs via buttons or something

Haakon Birkeland

Using the SendMessage API with ES_CENTER as a param, I suppose..

TechSupport

Quote from: paulDiagnoshow can i do this in code? so i can change bits and bobs via buttons or something

According to my copy of Rector and Newcomer, the %ES_CENTER class style can only be set at creation time. Sorry. In order to change the alignment you would need to destroy and re-create the control.

Haakon Birkeland

QuoteRector and Newcomer
Elaborate please..

Quote..can only be set at creation time.
Hateable!  :x

TechSupport

Rector and Newcomer.....

"Win32 Programming: Brent E. Rector and Joseph M. Newcomer" - a very good book that I use as my primary reference. You can get it from http://www.amazon.com/exec/obidos/ASIN/0201634929/planetsquires-20?creative=327641&camp=14573&link_code=as1

The book is not merely a reference book. It goes into deep detail about a lot of topics and draws upon the author's years and years of practical experience. They point out many instances where Microsoft has screwed up and have undocumented bugs/features.

Usually you can set styles after creation via a SetWindowLong call:
SetWindowLong hwnd, %GWL_STYLE, style

However, in this case.... you can't.