Recent

Author Topic: TMemo or TEdit without Frame in a TScroller with different color ... How To ?  (Read 2137 times)

paule32

  • Full Member
  • ***
  • Posts: 176
Hello,
I have a TMemo that I would like to use as Text-Input.
It works, but I get a red background, with a white or cyan Text Color.
That is not what I want !

I have tried to set the Palette, but the color of the TMemo is alway red.
Here, I have using C++ Code, but I think it should do be able to use it
under FPC like under C++:

Code: C  [Select][+][-]
  1. class PL_dBaseSourceMemoEditor: public TEditor {
  2. public:
  3.         PL_dBaseSourceMemoEditor(
  4.                 const TRect& bounds,
  5.                 TScrollBar * vsb,
  6.                 TScrollBar * hsb,
  7.                 TIndicator * ind,  uint32_t len) :
  8.                 TEditor(bounds,vsb,hsb,ind, len) {
  9.         }
  10.  
  11.         TPalette& getPalette() const
  12.         {
  13.                 #define cpdBaseMemoEditor "\x1a\x17"
  14.                
  15.                 static TPalette palette(
  16.                 cpdBaseMemoEditor, sizeof( cpdBaseMemoEditor)-1 );
  17.                
  18.                 return palette;
  19.         }
  20.        
  21.         void handleEvent( TEvent& event ) {
  22.                 if ( event.what != evKeyDown || event.keyDown.keyCode != kbTab )
  23.                 TEditor::handleEvent(event);
  24.         }
  25. };
  26.  

in a TWindow sub class, I use:

Code: C  [Select][+][-]
  1. auto *memo = new PL_dBaseSourceMemoEditor(
  2.         TRect(28,1, 22+22+22+6,21),
  3.         vScrollBar,
  4.         hScrollBar,
  5.         new TIndicator(TRect(40,13,20,24)),65255);
  6. insert( memo );
  7.  

Would be great, if someone can help me with this
Thank you !

 

TinyPortal © 2005-2018