eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'LinkButton':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: LinkButton


Inheritance:

   Object
   |
   +--GraphicsMedium
      |
      +--DisplaySurface
         |
         +--SimpleView
            |
            +--View
               |
               +--Label
                  |
                  +--Button
                     |
                     +--LinkButton

Package:
stx:libwidg2
Category:
Views-Layout
Version:
rev: 1.23 date: 2019/05/28 09:09:53
user: cg
file: LinkButton.st directory: libwidg2
module: stx stc-classLibrary: libwidg2
Author:
cg (cg@CG-VOSTRO)

Description:


Looks like a Label, but behaves like a button with individually clickable text components.
Can be used to create html-page-look-alike links in a view,
especially to make label-looking action buttons (as in the browser's info view).


[instance variables:]

[class variables:]


Related information:



Class protocol:

defaults
o  updateStyleCache
extract values from the styleSheet and cache them in class variables


Instance protocol:

accessing
o  actionAt: aPoint
take action from logo, which is normally a text with an action-emphasis

o  labelsAndActions
returns the collection of label->action associations.
For display, the label strings are drawn as one concatenated string (add separating spaces, if you have to).
When clicked on a string, the corresponding action is called

o  labelsAndActions: aCollectionOfAssociations
set the collection of label->action associations.
For display, the label strings are drawn as one concatenated string (add separating spaces, if you have to).
When clicked on a string, the corresponding action is called

o  level: anInteger

initialization
o  allViewBackground: something if: condition
set the viewBackground to something, a color, image or form,
in myself and recursively in all of my subviews

o  defaultControllerClass

o  initStyle
activeFgColor := enteredFgColor := foreground.

o  initialize

private
o  actionEmphasisIn: aText atPoint: aPoint
check for an actionBlock-emphasis in aText at aPoint.
Answer an Array with the whole emphasis and the actionBlock,
or nil

o  labelsAndActionsWithPositionsDo: aFourArgBlock

redrawing
o  drawFocusFrame
intentionally ignored

o  drawStringLogo: aString x: x y: y
redefined to draw any anchor under the mouse pointer with an underlined emphasis

o  is3D


Examples:


    |v l|

    v := StandardSystemView new.
    l := LinkButton in:v.
    l label:
        (('Hello' actionForAll:[ Transcript showCR:'Hello Clicked']) 
        , ' '
        , ('World' actionForAll:[ Transcript showCR:'World Clicked'])).

    v open
    |v l|

    v := StandardSystemView new.
    l := LinkButton in:v.
    l label:
        ((('Hello' actionForAll:[ Transcript showCR:'Hello Clicked']) colorizeAllWith:(Color blue)) 
        , ' '
        , ('World' actionForAll:[ Transcript showCR:'World Clicked'])).

    v open
    |v l|

    v := StandardSystemView new.
    l := LinkButton in:v.
    l labelsAndActions:{ 
                        'Hello' -> [ Transcript showCR:'Hello Clicked'].
                        ' ' -> nil.
                        'World' -> [ Transcript showCR:'World Clicked'].
                       }.
    l foregroundColor:Color blue.
    v open
    |v l|

    v := StandardSystemView new.
    l := LinkButton in:v.
    l labelsAndActions:{ 
                        'Hello' -> nil.
                        ' ' -> nil.
                        'World' -> [ Transcript showCR:'World Clicked'].
                       }.
    l foregroundColor:Color blue.
    v open
Dialog aboutToOpenBoxNotificationSignal handle:[:ex | |lbl| lbl := LinkButton label:(('XXX' colorizeAllWith:Color blue) actionForAll:[ Transcript showCR:'xxx' ]). ex box verticalPanel addComponent:lbl. ] do:[ self warn:'Bla bla bla' ].

ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Sat, 20 Apr 2024 19:23:50 GMT