Recent

Author Topic: use the TMemo of a class  (Read 492 times)

zzamyy

  • New Member
  • *
  • Posts: 10
use the TMemo of a class
« on: May 30, 2020, 11:33:08 pm »
hello,
i got this class type inside a TForm
Code: Pascal  [Select][+][-]
  1. type
  2. Obra_set_=class
  3. public
  4.   Panel_fuck: TPanel;
  5.   image:TImage;
  6.   Introduccion_button:TButton;
  7.   name_item:TLabel;
  8.   date_title:TLabel;
  9.   dimentions_title:TLabel;
  10.   price_item:TLabel;
  11.   discriminante_municipal:TLabel;
  12.   sender_:TMethod;
  13.   introduccion:TMemo;
  14.   url:String;
  15.   url_2:TLabel;
  16.   procedure show_introduccion(Sender:TObject;S:Pointer);
  17. end;

i will like to use the procedure to change a caption in TMemo

eljo

  • Sr. Member
  • ****
  • Posts: 408
Re: use the TMemo of a class
« Reply #1 on: May 31, 2020, 12:50:03 am »
what is this, turbo vision based?

TRon

  • Sr. Member
  • ****
  • Posts: 287
Re: use the TMemo of a class
« Reply #2 on: May 31, 2020, 01:59:06 am »
i will like to use the procedure to change a caption in TMemo
1) A TMemo component does not have a caption, it does however has a property that can be used to access the contents of the memo. https://lazarus-ccr.sourceforge.io/docs//lcl/stdctrls/tmemo.html (see property lines)

that means that the author of that code is probably using a label for the caption that is 'linked' to the memo (we have no way of knowing which one that is), which leads to
2) Changing the text of a label is not done by a procedure rather by setting a property https://lazarus-ccr.sourceforge.io/docs//lcl/stdctrls/tlabel.html (see property caption)


jamie

  • Hero Member
  • *****
  • Posts: 3124
Re: use the TMemo of a class
« Reply #3 on: May 31, 2020, 04:05:02 pm »
I believe the poster means the contents of the memo.


In which you can just do this.

 Memo.Lines.Text := A_String_Of_Mine;
The only true wisdom is knowing you know nothing

zzamyy

  • New Member
  • *
  • Posts: 10
Re: use the TMemo of a class
« Reply #4 on: June 02, 2020, 04:05:25 am »
i get a mistake in this class

Code: Pascal  [Select][+][-]
  1. procedure TControl.SetHeight(Value: Integer);
  2.  
  3.   procedure CheckDesignBounds;
  4.   begin
  5.     // the user changed the height
  6.     if Value<0 then
  7.       raise EInvalidOperation.Create(
  8.         'TWinControl.SetHeight ('+DbgSName(Self)+'): Negative height '
  9.           +dbgs(Value)+' not allowed.');
  10.     if Value>=10000 then
  11.       raise EInvalidOperation.Create(
  12.         'TWinControl.SetBounds ('+DbgSName(Self)+'): Height '
  13.           +dbgs(Value)+' not allowed.');
  14.   end;
  15.  
  16. begin
  17.   {$IFDEF CHECK_POSITION}
  18.   if CheckPosition(Self) then
  19.   DebugLn('[TControl.SetHeight] ',Name,':',ClassName,' ',dbgs(Value));
  20.   {$ENDIF}
  21.   if csLoading in ComponentState then
  22.   begin
  23.     FReadBounds.Bottom := FReadBounds.Top + Value;
  24.     Include(FControlFlags, cfHeightLoaded);
  25.   end;
  26.   if [csDesigning, csDestroying, csLoading] * ComponentState = [csDesigning] then
  27.     CheckDesignBounds;
  28.   SetBounds(FLeft, FTop, FWidth, Max(0, Value));
  29. end;
  30.      
an execption in SIGSEGV
in the file "include\control.inc"
also is a class for use many times.

Blaazen

  • Hero Member
  • *****
  • Posts: 2817
  • POKE 54296,15
    • Eye-Candy Controls
Re: use the TMemo of a class
« Reply #5 on: June 02, 2020, 04:31:41 am »
SIGSEGV looks like
Code: Pascal  [Select][+][-]
  1. introduccion: TMemo;
is not created.
If you do not use Form Editor you have to create all that controls manually.
Lazarus 2.1.0 r61214:62238 FPC 3.3.1 r40507 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

 

TinyPortal © 2005-2018