Implement Comment logic using CDK

forum.cdk (2000-2005) & forum.td.cdk (2005-2010)
Rafael Kuzminski

Implement Comment logic using CDK

Post by Rafael Kuzminski » 13 Apr 2007, 14:40

 Posted by:  Rafael Kuzminski 

Problem 1:

I'm trying to write a CDK app where you can comment/uncomment the outline
code that is currently selected (anywhere in the app). As far as I have
figured out, there are no direct comment/uncomment methods in CDK like
cdkItem.Comment or cdkItem.Uncomment( ). How can I achieve that
functionality?

Problem 2:

I can insert a block of comments into my app like

* ! A

* ! B

* ! C

(using cdkItem.InsertFirstItem( cdkParentItem, CDK_IT_Comment, cdkNewItem )

but there's no way in having B intended under ! A WIHTOUT having the !
character like:

* ! A

* B

* ! C

I only get this:

* ! A

* ! B

* ! C

Is there a way to solve that somehow?

Regards

/Rafael

Jeff Luther
Site Admin
Site Admin
United States of America
Posts: 2069
Joined: 04 Mar 2017, 18:34
Location: Palm Springs, California

Implement Comment logic using CDK

Post by Jeff Luther » 13 Apr 2007, 18:34

 Posted by:  Jeff Luther 

Maybe I can help with your first problem re comments. I've included a number
of files in a zip -- NG msgs. and samples -- that have been posted about
this topic over the past couple years. I've just given you what I have;
you will need to look through to see what might help you.

Re your insert of a block of comments:
"there's no way in having B intended under ! A WIHTOUT having the !" - Not
quite true, *if* your comment is > 1 line and you indent 'by hand' using
a tab. Then, a single outline item would look like:
! some comment
new line... and tabbed-in line
and the string would be: 'some comment
new line... and tabbed-in line'

added a comment should work. If you mean that your example below:
> * ! A
>
> * B

are 2 separate outline items -- I guess the "*" is the diamond -- then of
course it can't be that way; a commented outline item must begin with the
"!" character, otherwise TD will try to parse it as a line of SAL code.

Best Regards,
Jeff @ PC Design
info: www.JeffLuther.net/gupta/

Attachment: comment item.zip

Rafael Kuzminski

Implement Comment logic using CDK

Post by Rafael Kuzminski » 16 Apr 2007, 09:40

 Posted by:  Rafael Kuzminski 

Thanks for all the info. A lot of good examples, indeed!

You're right regarding the second issue. But also as you wrote, when you use
ONE outline item, you can use tabbing to create intended text. But in my
case, I want to create a uncommented chile item, intended under the parent
item which is commented.

Actually, I found a "dirty" way in doing that -> Since I use a "hardcodede"
comment template (3 lines with A,B & C on each line), I can initialize the
clipboard with the statement and paste in inte the outline like:

Call CDK_App.InitializeFramework( )
If CDK_App.GetFirstSelection( FirstItem )
Call FirstItem.GetParent( Parent )
Call CopyDataToClipboard( hWndNULL, '!!CB!! 129
A
B
C
' )
Call FirstItem.DoCommand( CDK_CmdOutlineEditPaste, STRING_Null )

That will result in excatbly what I want.

Regards

/Rafael

Return to “td.cdk”

Who is online

Users browsing this forum: [Ccbot] and 0 guests