Solved

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

Posted on 2007-04-05
4
3,109 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
  • 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

828 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