Solved

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

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
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…

770 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