eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'TabItem':

Home

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

Class: TabItem


Inheritance:

   Object
   |
   +--Model
      |
      +--TabItem

Package:
stx:libwidg2
Category:
Views-Support
Version:
rev: 1.54 date: 2023/11/07 16:29:10
user: cg
file: TabItem.st directory: libwidg2
module: stx stc-classLibrary: libwidg2

Description:


describes one tab entry; could be used for tabs instead of a string. Whenever
a value changed, a change notification is raised

copyright

COPYRIGHT (c) 1997 by eXept Software AG 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:

instance creation
o  label: aLabel


Instance protocol:

accessing
o  accessCharacterPosition
get the index of the access character in the label text or string, or 0 if none

o  accessCharacterPosition: anIndex
set the index of the access character in the label

o  argument
returns a user defined argument or nil

o  argument: anArgument
set a user defined argument

o  createNewBuilder
returns true if a new builder is used to create the canvas;
the default is true

o  createNewBuilder: aBool
set/clear the flag which controls if a new ui-builder is used to create the canvas;
the default is true. This affects if the bindings will be shared or not between tabs.

o  destroyTabAction
if non-nil, this tab has its own private destroyButton.
This can be used for individual tabs; for an overall tab-destroy capability,
change the destroyTab: action of my owning tabView

o  destroyTabAction: aBlock
if non-nil, this tab has its own private destroyButton.
This can be used for individual tabs; for an overall tab-destroy capability,
change the destroyTab: action of my owning tabView

o  enabled
get the enabled state of the tab

o  enabled: aBoolean
set the enabled state of the tab

o  hasView

o  label
get the label or selector to access a label/bitmap.
To get the label to be shown use: #rawLabel

o  label: aLabel
set the label or selector to access the label/bitmap

o  nameKey
an additional (untranslated) key (do not use the label to identify tabs)

o  nameKey: aStringOrSymbol
an additional (untranslated) key (do not use the label to identify tabs)

o  printableLabel

o  shortcutKey
get the key to press to select the tab item from the keyboard; a symbol or nil

o  shortcutKey: aKeyOrNil
set the key to press to select the tab item from the keyboard; a symbol or nil

o  view

o  view: aView

accessing-canvas
o  canvas
returns the application or view. Creates one if not already present

Usage example(s):

canvasClass := Smalltalk resolveName:classNameKey inClass:self class.

o  canvasApplication
returns the application the canvas is running

o  canvasOrNil
returns the application or nil - does NOT create one

o  canvasView
returns the view the canvas is running in or nil if no canvas
specified or not yet created

o  destroyCanvas

o  majorKey

o  majorKey: aMajorKey

o  minorKey

o  minorKey: aMinorKey

o  setupCanvasView: aView
not horizontal scrollable - always set x to scrolled view x

accessing-color & font
o  foregroundColor
get the label color or nil

o  foregroundColor: aColor
set the label color or nil

o  labelForegroundColor
get the label color or nil

o  labelForegroundColor: aColor
set the label color or nil

accessing-scrollbars
o  autoHideScrollBars

o  autoHideScrollBars: aBoolOrNil

o  hasHorizontalScrollBar

o  hasHorizontalScrollBar: aBool

o  hasVerticalScrollBar

o  hasVerticalScrollBar: aBool

o  miniScrollerHorizontal

o  miniScrollerHorizontal: aBool

o  miniScrollerVertical

o  miniScrollerVertical: aBool

building
o  applicationProvidesLabel
returns true if the label is acquired from the application

o  applicationProvidesLabel: aBool
set/clear the flag which controls if the label is provided by the application

o  editAgument
used by TabItemEditor to get the argument

o  editAgument: anArgument
used by TabItemEditor to set the argument

o  rawLabel
returns the label to be shown

o  setAttributesFromClass: aClass
setup attributes from aClass
Ugly: used only with the tabListEditor.

o  setAttributesWithBuilder: aBuilder
setup attributes dependent on the builder

o  translateLabel
returns true if the label derives from the application

o  translateLabel: aBool
set/clear the flag which controls if the label is translated to a national language
via the application's resources

converting
o  skippedInLiteralEncoding
define the inst-slots which are skipped when generating a literalArrayEncoding;
(to skip the ones with default values.)

displaying
o  displayOn: aGC x: x y: y
(comment from inherited method)
display the receiver in a graphicsContext - this method allows
for any object to be displayed in a ListView (or any view) - for example.

o  heightOn: aGC
(comment from inherited method)
return the height of the receiver, if it is to be displayed on aGC

o  widthOn: aGC
(comment from inherited method)
return the width of the receiver, if it is to be displayed on aGC

help
o  activeHelpKey
the key used to ask the application for the tooltip text (via helpTextFor:)

o  activeHelpKey: aSymbolicKey
the key used to ask the application for the tooltip text (via helpTextFor:)

o  activeHelpText

o  activeHelpText: aString

queries
o  isCanvasApplicationModel
returns true if the canvas is an application model

o  isEnabled


Examples:


labels derived from item
|top tab|

top := StandardSystemView new label:'tabs at top'; extent:250@100.
tab  := TabView origin:0.0 @ 0.0 corner:1.0 @ 0.5 in:top.

tab direction:#top.
tab list:(#( 'Foo' 'Bar' 'Baz' ) collect:[:l| TabItem label:l ]).
tab action:[:aName|Transcript showCR:aName].
top open.
|top tab list item|

top := StandardSystemView new label:'tabs at top'; extent:400@400.
tab  := NoteBookView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.

tab direction:#top.
list := #( 'Foo' 'Bar' 'Baz' ) collect:[:l| TabItem label:l ].

item := list at:1.
item majorKey:ClockView.

item := list at:2.
item majorKey:CodingExamples_GUI::GUIDemoNoteBook.

item := list at:3.
item majorKey:CodingExamples_GUI::GUIDemoMenu.

tab list:list.
top open.
testing tab configuration and change notifications
|top tab list idx label|

top := StandardSystemView new label:'tabs at top'; extent:250@100.
tab  := TabView origin:0.0 @ 0.0 corner:1.0 @ 0.5 in:top.

tab direction:#top.
list := (#( 'Foo' 'Bar' 'Baz' ) collect:[:l| TabItem label:l ]).
tab list:list.
tab action:[:aName|Transcript showCR:aName].
top openAndWaitUntilVisible.

[
    idx := 0.
    label := LabelAndIcon icon:(Image fromFile:('xpmBitmaps/document_images/tiny_yellow_dir.xpm' ))
                        string:'Test Tab'.

    [top shown] whileTrue:[
        |aTab lbl|

        (idx := idx + 1) > list size ifTrue:[idx := 1].

        aTab := list at:idx.
        lbl  := aTab label.

        Delay waitForSeconds:0.5. aTab label:label.
        Delay waitForSeconds:0.5. aTab enabled:false.
        Delay waitForSeconds:0.5. aTab enabled:true.
        Delay waitForSeconds:0.5. aTab foregroundColor:(Color red).
        Delay waitForSeconds:0.5. aTab foregroundColor:nil.
        aTab label:lbl.
    ]
] forkAt:1.


ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sat, 21 Dec 2024 17:23:21 GMT