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.27 date: 2021/01/20 15:21:00
user: cg
file: LinkButton.st directory: libwidg2
module: stx stc-classLibrary: libwidg2

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:]

copyright

COPYRIGHT (c) 2009 by Claus Gittinger All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred.

Class protocol:

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


Instance protocol:

accessing
o  actionAt: aPoint
if aPoint is over a clickable (anchor-) link, return its helptext.
Otherwise, return nil

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
(comment from inherited method)
set my 3D effect level relative to superView in nr of pixels

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
(comment from inherited method)
must be called if redefined

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.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sat, 27 Jul 2024 02:28:08 GMT