class: ActiveHelpView
authorClaus Gittinger <cg@exept.de>
Tue, 18 Mar 2014 16:08:20 +0100
changeset 3313 05f5ca07ddbf
parent 3312 1bcdfdff5af7
child 3314 552383bb5952
class: ActiveHelpView changed: #for:onDevice: #withView: preliminary support for HTML text as help text; if help text starts with '<HTML>', an html-view is created.
ActiveHelpView.st
--- a/ActiveHelpView.st	Mon Mar 17 14:48:17 2014 +0100
+++ b/ActiveHelpView.st	Tue Mar 18 16:08:20 2014 +0100
@@ -91,10 +91,17 @@
     |helpView textView|
 
     helpView := self onDevice:aDevice.
-
-    textView := Label onDevice:aDevice.
-    textView font:(helpView font onDevice:aDevice).
-    ^ (helpView withView:textView) contents:someText
+    (someText startsWith:'<HTML>') ifTrue:[
+        textView := HTMLView onDevice:aDevice.
+        textView level:0.
+        textView contents:someText.
+        textView preferredExtent:(textView extentOfContents + 20 min:(Display extent * 2 // 3)).
+        ^ helpView withView:textView 
+    ] ifFalse:[
+        textView := Label onDevice:aDevice.
+        textView font:(helpView font onDevice:aDevice). 
+        ^ (helpView withView:textView) contents:someText
+    ].
 
     "
      |v|
@@ -177,6 +184,10 @@
         (fg := styleSheet colorAt:#'activeHelp.foregroundColor' default:nil) notNil ifTrue:[
             aView foregroundColor:fg.    
         ].
+    ] ifFalse:[
+        (aView isKindOf:HTMLView) ifTrue:[
+            aView style viewBGColor:viewBackground.
+        ].
     ].
     self addSubView:aView.
     myView := aView.
@@ -386,10 +397,10 @@
 !ActiveHelpView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/ActiveHelpView.st,v 1.42 2014-02-18 16:06:52 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/ActiveHelpView.st,v 1.43 2014-03-18 15:08:20 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview2/ActiveHelpView.st,v 1.42 2014-02-18 16:06:52 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/ActiveHelpView.st,v 1.43 2014-03-18 15:08:20 cg Exp $'
 ! !