Re: getTextExtent question
- Posted by George Walters <gwalters at sc.rr.com> Dec 16, 2004
- 502 views
Derek Parnell wrote: > > George Walters wrote: > > > > > > I've been using this code snippet to get the extent of characters, but I > > must > > be doing something wrong. The MleText control below shows an X extent of > > cx*30 > > which I want it to be enough space to allow 30 characters on each line. I > > can > > get only 17 characters. Does anyone see anything wrong. > > > > }}} <eucode> > > setFont(Screen, "Courier New", fs, Normal) > > charSize = getTextExtent(Screen,"abcdefghij") > > > > cx = charSize[1]/10 > > cy = charSize[2]+3 > > > > commentsId = create(MleText, "", invoiceParameters, cx*3, cy*3, cx*30, > > cy*4,0) > > setFont(commentsId,"Courier New", fs, Normal) > > tmp = sendMessage(commentsId,EM_LIMITTEXT,108,NULL) > > > > </eucode> {{{ > > The 'create()' dimensions set the size of the *outside* edge of the control. > It doesn't make allowances for scrollbars or control borders. > > May I suggest that after you have created the MLE, you call setClientRect() > to set the size of the inner space of the control. > > -- > Derek Parnell > Melbourne, Australia > Derek, this would be upside down for what I'm trying to do. I want to create a MLE that is 30 chars wide and 4 lines deep. IT's an input box for the user to construct a message that will go on all the invoices for the day..like this ************************** * THANK YOU FOR * * YOUR BUSINESS * ************************** So I need an input box that would always be 30x4. How's the bestway to do that? I could get it right for one computer but with a screen size change and char size change it would be broken