Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 248
  • Last Modified:

Property dilemna

I'm using a component written by a company that is no longer in business, and therefore don't have a support technician to pose this question to, so I thought I'd try ExpEx.

A memo component has Caret property, which has a Shape property.  The Shape property is of a special type called "TOvcCaretShape". I'm trying to change the caret shape, but can't find the right syntax.

According to the help file that came with the component, we find...

property Shape : TOvcCaretShape
TOvcCaretShape = (csBlock, csHalfBlock, csVertLine, csHorzLine, csCustom, csBitmap)

That's all I have in the way of "documentation".  No examples are provided.  I tried the following code, but it fails...

SuperMemo.Caret.Shape := csBlock;

...with compiler message 'Undeclared identifier csBlock' even though in the component include source you will find this...

type
  TOvcCaretShape = (                 {Predefined caret shapes..}
                    csBlock,         {..block over whole cell}
                    csHalfBlock,     {..block over bottom part of cell}
                    csVertLine,      {..vertical line to left of cell}
                    csHorzLine,      {..horizontal line on bottom of cell}
                    csCustom,        {..custom width/height}
                    csBitmap);       {..bitmap caret, custom width/height}

Can anyone help figure out the correct syntax to use to change the Cursor.Shape?
0
Monroe406
Asked:
Monroe406
  • 2
1 Solution
 
rfwoolfCommented:
Only trying to help...
If you have the sourcecode, load the .pas file of the component (and any related units that came with the component), then search in files for all mentions of the word "Shape" or "Caret.Shape" or "CsBlock" or "csBitmap" etc

If you find the way that they specify this in the sourcecode, it may just help
0
 
Monroe406Author Commented:
>> If you have the sourcecode, load the .pas file

I have the source, and I've already done what you suggested.  None of the references in the source will work.


You find stuff like this...

    if (edCaret.CaretType.Shape in [csBlock, csHalfBlock, csHorzLine]) or
       (edCaret.CaretType.CaretWidth > 4) then
      Inc(X);


type
  {Class defining a caret shape}
  TOvcCaret = class(TPersistent)
  {.Z+}
  protected
    {property fields}
    FAlign     : TOvcCaretAlign;      {Caret alignment in cell}
    FShape     : TOvcCaretShape;      {Shape}
    procedure SetShape(S : TOvcCaretShape);

{.Z-}

  published
    {properties}
    property Shape : TOvcCaretShape
        read FShape write SetShape
        default csVertLine;


{---TOvcCaret----------------------------------------------------}
constructor TOvcCaret.Create;
  begin
    inherited Create;

    FShape     := csVertLine;
    FAlign     := caLeft;
    FCaretHt   := 10;
    FCaretWd   := 2;
  end;

procedure TOvcCaret.SetShape(S : TOvcCaretShape);
  begin
    if (S <> FShape) then
      begin
        FShape := S;
        case FShape of
          csBlock:
            FAlign := caLeft;
          csVertLine :
            begin
              FAlign := caLeft;
              FCaretWd := 2;
            end;
          csHalfBlock:
            FAlign := caBottom;
          csHorzLine :
            begin
              FAlign := caBottom;
              FCaretHt := 2;
            end;
          csBitmap :
            begin
              FCaretHt := FBitMap.Height;
              FCaretWd := FBitMap.Width;
            end;
        end;{case}
        NotifyChange;
      end;
  end;
0
 
Monroe406Author Commented:
I figured out the solution.  Turns out that the caret properties were stored in a unit separate from the memo unit, meaning I needed to add the caret unit to my USES block.

How do I delete this question?
0
 
Computer101Commented:
PAQed with points refunded (125)

Computer101
EE Admin
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now