Monroe406
asked on
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?
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?
ASKER
>> 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.CaretWi dth > 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;
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.CaretWi
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;
ASKER
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?
How do I delete this question?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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