Solved

Delphi 5  Define the tab width withi text in a memo field

Posted on 2007-04-05
4
3,153 Views
Last Modified: 2008-03-18
Dear Experts,
    The below codes will compute the string and put in into a temp table memo field . What is the tab ( #9) width by default and how do I redefine it ( I want to make it smaller width between column ) .
( Delphi 5 ,Paradox ) . The string consist of Chinese character , and I want to put string in memo field .

*********************************
with sqlMaster do begin
    while (not Eof) do begin
        iCount :=iCount +1;
        s1 := s1 + Trim(SubStr(sqlMasterName.AsString ,iLen +1,6))+#9;
        if iCount =12 then s1:= Trim(s1) + #13;
        Next;
     end;
end;
with tbltemp  do begin
   Append;
   fieldByName('MemoField').Asstring := s1;
   post;
end;
0
Comment
Question by:gohje
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 26

Expert Comment

by:EddieShipman
ID: 18858065
See:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/editcontrols/editcontrolreference/editcontrolmessages/em_settabstops.asp

or

http://tinyurl.com/34fhqj

"The EM_SETTABSTOPS message sets the tab stops in a multiline edit control. When text is copied to the control, any tab character in the text causes space to be generated up to the next tab stop.

This message is processed only by multiline edit controls. You can send this message to either an edit control or a rich edit control."
0
 
LVL 26

Accepted Solution

by:
EddieShipman earned 250 total points
ID: 18858079
Posted by "Atanas Stoyanov" on Borland newsgroups:

Follows an example usage of the EM_SETTABSTOPS message. You will notice
that the EM_SETTABSTOPS message expects the tabs to be in dialog units. To
convert pixels to units is used the following formula:

DlgU_X := (Pixels_X * 4) / LoWord(GetDialogBaseUnits);


const NumTabs = 5;
var Tabs : array[1..NumTabs] of Integer;
var XdlgUnits : Integer;
begin

  XdlgUnits := LoWord(GetDialogBaseUnits);//X-dialog units
  Tabs[1] := (40 *4) div XdlgUnits;
  Tabs[2] := (80 *4) div XdlgUnits;
  Tabs[3] := (120*4) div XdlgUnits;
  Tabs[4] := (200 *4) div XdlgUnits;
  Tabs[5] := (Memo1.Width * 4) div XdlgUnits;
  SendMessage(Memo1.Handle,EM_SETTABSTOPS,NumTabs,LongInt(@Tabs));
end;
0
 
LVL 1

Expert Comment

by:Computer101
ID: 21156541
Forced accept.

Computer101
EE Admin
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question