Right Justification in CEdit derived control
Derek F. Groft - UTL -- derek.groft@utiligent.com Monday, December 30, 1996 Environment: VC++4.2b, NT4.0 This is probably quite basic, but I have a class derived from CEdit and I want to force the contents to be right justified. The IDE has several styles for an edit control that seem like they might work ( "Right aligned text" for example), but they do not seem to do anything. There is also an "Align text" combo box in the Edit Properties menu, but it is only available for multi-line entry fields, which is not what I want. Best case, I would like the text to actually enter from right to left. Worst case, I would like for the text to jump to the right edge at OnKillFocus time. I implemented right justification in a ListCtrl by overriding the DrawItem function. As a general question, any particular reason why CEdit controls are not owner-draw-able? Thanks for your help, Derek
David Little -- dlittle@equinoxcorp.com Tuesday, December 31, 1996 [Mini-digest: 2 responses] Make your edit box a multi-line edit box, but don't change its size. = Then, dont process keystrokes that would add a line (VK_ENTER, etc....), = and call SetLimitText() to stop "soft" additions.... David ---------- From: Derek F. Groft - UTL[SMTP:derek.groft@utiligent.com] Sent: Monday, December 30, 1996 6:16 PM To: mfc-l@netcom.com Subject: Right Justification in CEdit derived control Environment: VC++4.2b, NT4.0 This is probably quite basic, but I have a class derived from CEdit and = I want to force the contents to be right justified. The IDE has several styles for an edit control that seem like they might work ( "Right = aligned text" for example), but they do not seem to do anything. There is also = an "Align text" combo box in the Edit Properties menu, but it is only available for multi-line entry fields, which is not what I want. Best case, I would like the text to actually enter from right to left.=20 Worst case, I would like for the text to jump to the right edge at OnKillFocus time. I implemented right justification in a ListCtrl by overriding the = DrawItem function. As a general question, any particular reason why CEdit = controls are not owner-draw-able? Thanks for your help, Derek -----From: Stuart DowningThe "right-aligned text" checkbox corresponds to an extended window style (WS_EX_RIGHT) that applies to right-to-left reading order languages like Hebrew and Arabic. You want the multi-line style (ES_MULTILINE) in combination with the Align text-right style (ES_RIGHT). Make sure you DON'T specify the vertical scroll style. A multiline edit control will only allow as many lines as can be displayed in the control. So long as your control is not too tall, the user will only be able to enter a single line of text anyway, and you get the right justification you want. If you play around with the edit control height and styles, you'll see this for yourself. ----- Stuart Downing Thanks David E. sdowning@fame.com FAME Information Services, Inc. ---------- From: Derek F. Groft - UTL[SMTP:derek.groft@utiligent.com] Sent: Monday, December 30, 1996 7:16 PM To: mfc-l@netcom.com Subject: Right Justification in CEdit derived control Environment: VC++4.2b, NT4.0 This is probably quite basic, but I have a class derived from CEdit and I want to force the contents to be right justified. The IDE has several styles for an edit control that seem like they might work ( "Right aligned text" for example), but they do not seem to do anything. There is also an "Align text" combo box in the Edit Properties menu, but it is only available for multi-line entry fields, which is not what I want. Best case, I would like the text to actually enter from right to left. Worst case, I would like for the text to jump to the right edge at OnKillFocus time. I implemented right justification in a ListCtrl by overriding the DrawItem function. As a general question, any particular reason why CEdit controls are not owner-draw-able? Thanks for your help, Derek
| Вернуться в корень Архива |