eXept Software AG Logo

Smalltalk/X Webserver

Smalltalk Dynamic Web Pages - Source of WebDemoApp1-theSVG1:

Home

Documentation
www.exept.de
Everywhere
for:
theSVG1:aRequest
    "a reply, generating svg which is embedded by test_svg1:"

    |builderClass builder|

    "/ suppress decoration
    aRequest response replyPresenter:nil.

    (builderClass := Smalltalk classNamed:'HTML::SVGTreeBuilder') isNil ifTrue:[
        Smalltalk loadPackage:'stx:goodies/webServer/htmlTree/svg'.
        (builderClass := Smalltalk classNamed:'HTML::SVGTreeBuilder') isNil ifTrue:[
            self error:'failed to load SVG package'.
        ].
    ].
    builder := builderClass new.
    builder
       svg; 
         viewBox:(0@0 corner:270@400);
         width:'100%';
         height:'100%';
         g; id:'mainlayer';
           rect; 
             fill:'red'; stroke:'black'; x:15; y:15; width:100; height:50;
             onClick:'alert(''you clicked on red'');';
           rectEnd;
           rect; 
             fill:'blue'; stroke:'black'; x:150; y:15; width:100; height:50; rx:12; ry:18; 
             onClick:'alert(''you clicked on blue'');';
           rectEnd;
         gEnd;
       svgEnd.

    aRequest response
        nextPutAll:(builder xmlString)

Edit (disabled)
Index


ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Mon, 30 Dec 2024 17:28:42 GMT