Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
Topic Title: Buttons for text formatting in a dialog box
Topic Summary:
Created On: 9-Jul-2008 18:59
Status: Post and Reply
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 9-Jul-2008 18:59
User is offline View Users Profile Print this message


Pranav Chandrasekhar

Posts: 101
Joined: 16-May-2006

Hi All,

I have created an interface using dialog boxes (scripted in DXL). In one of the dialog boxes, we need buttons for the bold, underline, and strikethrough capabilites for a richText field. Any idea how I might accomplish this? Any input will be highly appreciated.

Regards,

Pranav
Report this to a Moderator Report this to a Moderator
 9-Jul-2008 20:06
User is offline View Users Profile Print this message


David Pechacek

Posts: 674
Joined: 5-Dec-2006

You can get the selected text indexes from a text editor element. Apply the appropriate RTF tags to the selected text, then recombine with the rest of the text and put the new rich text back in the rich text box.

int startOfSelection;
int endOfSelection;
get(DBE yourRichTextDBE, startOfSelection, endOfSelection);

-------------------------
David Pechacek
AAI Services Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com
Report this to a Moderator Report this to a Moderator
 9-Jul-2008 21:29
User is offline View Users Profile Print this message


Pranav Chandrasekhar

Posts: 101
Joined: 16-May-2006

Thank you for your prompt response to my post.

I have done this but it does not work that well when your DBE that you pass the 'get' function is a richText box. The 'get' function will treat it as a non-richText field (leaves out all of the markup) and return the start and end of selection indices. This is fine except for when you extract the text from the richText box it contains the rich text markup so indices will not take you to the correct place.

I am curious what gets called when the 'B' (bold) button gets pressed in the Formal module when you want to bold text in the Object Text. If I could find that or emulate it somehow that would make my life easier.
Report this to a Moderator Report this to a Moderator
 10-Jul-2008 22:48
User is offline View Users Profile Print this message


David Pechacek

Posts: 674
Joined: 5-Dec-2006

Well for bold and underline, the Windows shortcut keys work in rich text boxes (Ctrl+B and Ctrl+U). That only leaves a strikethrough button being actually necessary.

-------------------------
David Pechacek
AAI Services Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com
Report this to a Moderator Report this to a Moderator
 10-Jul-2008 23:02
User is offline View Users Profile Print this message


David Jakad

Posts: 94
Joined: 20-Jul-2007

I haven't toyed with this yet, but if you want | B | I | U |buttons on a dialog box that you click with the mouse, you would probably have to:

1.) get the selected text
2.) get the entire rich text from the same box
3.) do a fancy regular expression search of the entire rich text to find the bold/italic/underline rich text tags just before and just after your selected text

Rich tags off the top of my head:
\\b - start bold
\\b0 - stop bold
\\i - start italics
\\i0 - stop italics
\\u - start underline
\\u0 - stop underline
Report this to a Moderator Report this to a Moderator
 17-Jul-2008 19:05
User is offline View Users Profile Print this message


Pranav Chandrasekhar

Posts: 101
Joined: 16-May-2006

Hi,
I sincerely apologize for not having acknowledged your post earlier. I have attached the snippet of code. This might offer a clearer view of what I am trying to do. Any input would be appreciated. Thank you.

Regards,

Pranav
Report this to a Moderator Report this to a Moderator
 17-Jul-2008 20:14
User is offline View Users Profile Print this message


David Pechacek

Posts: 674
Joined: 5-Dec-2006

Well what stands out to me is that the "inplaceTextBoldItem" item does not exist in the list of standard items.

Update: If you read the documentation, it states that you must specify the two boolean arguments of the createButtonBar function when "the toolbar is hosted without a canvas"

Specifying these I get the error that the standard item "inplaceTextBoldItem" is " invalid standard item for configuration context". So obviously they restrict their usage to the module window.

-------------------------
David Pechacek
AAI Services Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com

Edited: 17-Jul-2008 at 20:40 by David Pechacek
Report this to a Moderator Report this to a Moderator
 24-Jul-2008 18:33
User is offline View Users Profile Print this message


Pranav Chandrasekhar

Posts: 101
Joined: 16-May-2006

If you read the documentation, it states that you must specify the two boolean arguments of the createButtonBar function when "the toolbar is hosted without a canvas"


I just scanned the documentation and unable to find a reference to the two boolean arguments. Am I missing something here? Thank you for your help.

Pranav
Report this to a Moderator Report this to a Moderator
 24-Jul-2008 20:18
User is offline View Users Profile Print this message


David Pechacek

Posts: 674
Joined: 5-Dec-2006

void createButtonBar([string name, Sensitivity mappingCallback(), bool newRow,
bool showName])


The newRow parameter defines whether the toolbar is shown on a new row within the container control or not. The showName parameter defines whether the name of the toolbar is shown or not. Both newRow and showName are mandatory when the toolbar is hosted outwith a canvas.


-------------------------
David Pechacek
AAI Services Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com
Report this to a Moderator Report this to a Moderator
 30-Jul-2008 12:35
User is offline View Users Profile Print this message


Pranav Chandrasekhar

Posts: 101
Joined: 16-May-2006

Hi David,
I sincerely apologize for not having acknowledged your response earlier. I was wondering where in the documentation the bit you pasted is outlined in the documentation. Please do let me know. I am wondering if we are referring to same documentation. I am using the standard telelogic dxl reference manual. Thank you.

Regards,

Pranav
Report this to a Moderator Report this to a Moderator
 30-Jul-2008 12:52
User is offline View Users Profile Print this message


David Pechacek

Posts: 674
Joined: 5-Dec-2006

So am I. Just type in the index tab "createButtonBar" and go to it. Now I am using 8.3 so if you are not, perhaps the documentation (and the function) has changed.

-------------------------
David Pechacek
AAI Services Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 1 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 1 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.