spell check in VA

VA Smalltalk is a "100% VisualAge compatible" IDE that includes the original VisualAge technology and the popular VA Assist and WidgetKit add-ons.

Moderators: Eric Clayberg, wembley, tc, Diane Engles, solveig

spell check in VA

Postby xabialonso2 » Mon Jun 28, 2010 11:16 pm

I have the code below that is intended to kick off a word spell check on a MLE field in Visual Age.
It works beautifully except for the fact that the spell checker can only be opened by going to the task manager and click on the application.
Does anybody know how I can get this spell checker to appear without having to go to the task bar.

Thanks in advance

| tWordApp tAutoObj tTask tRC tDocs tDocument tText tFlag tOrigText tNewText |

tWordApp := WordAppWrapper createObject. "-Create Word Application wrapper"
tDocs := tWordApp documents: (OleAutomationObject createObject: 'Test').
tDocs := tWordApp documents.
tAutoObj := tDocs invoke: 'Add' withArguments: #().
tDocument := WordDocWrapper createObject. "-Create a temp document to use spell check"
tDocument automationObject: tAutoObj.

"-Position Word application off screen to avoid having document visible..."
tRC := (tDocument automationObject) propertyAt: 'WindowState' put: 0.
tRC := (tDocument automationObject) propertyAt: 'Top' put: -3000.

"-Put the text from the Multi-line edit field into the Word document "
tOrigText := aString.
"-Fix any Cr characters"
"tOrigText := self convertCrToCrLf: tOrigText."
tRC := tDocument content: tOrigText.

"-Invoke spell check on the contents of the document "

tDocument checkGrammar.
tDocument showSpellingErrors: true.
tRC := (tDocument propertyAt: 'content') invoke: 'CheckSpelling'
withArguments: #() returnType: true.

"-Read the contents back and put them in the entryfield with proper LF chars"
tNewText := (tDocument content) propertyAt: 'text'.
"tNewText := self convertCrToCrLf: tNewText."

"-Close the document"
tRC := tDocument close: false
originalFormat: nil
routeDocument: nil.

"-Close MS Word (Do NOT leave it hanging!)"
tRC := tWordApp quit: false
originalFormat: nil
routeDocument: nil.

(self subpartNamed: 'txtNotes') object: tNewText
Posts: 6
Joined: Mon Jun 14, 2010 6:59 pm

Return to VA Smalltalk 7.0, 7.5 & 8.0

Who is online

Users browsing this forum: No registered users and 1 guest