PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: paulDiagnos on November 10, 2004, 01:40:58 PM

Title: textbox
Post by: paulDiagnos on November 10, 2004, 01:40:58 PM
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
Title: textbox
Post by: TechSupport on November 10, 2004, 03:39:56 PM
Sure. Simply select the "ES_CENTER" style in the "WindowStyles" for the TextBox.
Title: textbox
Post by: paulDiagnos on November 11, 2004, 05:32:39 AM
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
Title: textbox
Post by: Haakon Birkeland on November 11, 2004, 07:55:02 AM
Using the SendMessage API with ES_CENTER as a param, I suppose..
Title: textbox
Post by: TechSupport on November 11, 2004, 10:27:15 AM
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.
Title: textbox
Post by: Haakon Birkeland on November 11, 2004, 11:41:20 AM
QuoteRector and Newcomer
Elaborate please..

Quote..can only be set at creation time.
Hateable!  :x
Title: textbox
Post by: TechSupport on November 11, 2004, 11:54:29 AM
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.