Basic Tutorials
Prev
Next

Basic Tutorials

Most of the information in this section is based on example dialogs some time ago, which unfortunately were not widely available as they were shipped with the source, but not installed. You should find them in your tools menu under examples in the “tutorial” section. Keep in mind most of these particular examples use the old parser. That is neither good nor bad. Most of the functionality in Kommander is shared in both parsers. It's just each is particularly suited to do a better job with a given task. As Kommander now defaults to the new parser you can set either one. Please see the New Parser docs for more information on the two parsers.

When examining example dialogs remember to look in the following places to see how things are done.

The following list of dialogs may be brief so as to focus on where more information is required to explain more complex tasks possible with Kommander. They were copied from Michal's notes.

Globals

Shows using global and setGlobal DCOP calls to provide global variables for script

Functions/concepts: - global - setGlobal - changeWidgetText

DCOP

Shows how to use both local and external DCOP calls to communicate with external application (here: KMail).

Functions/concepts: - external DCOP - addListItem - enableWidget - @selectedWidgetText - @widgetText

Slots

Shows how to us connections/slot to handle events. Both population and standard slots are used.

Note

Population text was originally developed before Kommander DCOP, specials and scripting. Given that everything it does can be done in other ways and that it is easy to forget to look here for problems, along with the inherent difference of introducing an additional behavior to explain, this is a deprecated function. It is left in for illustration, however while Kommander dialogs will be easy to port to KDE4 this feature is not assured to work in the future. Don't use it!

standard slots are used. - slots/connections - populate()

Settings

Shows how to use @readSetting and @writeSetting functions to write/restore widget content. Also, show how to use populate() slot to initialize widget content.

Functions/concepts: - @readSetting - @writeSetting - populate() - slots/connections - destroy

Append

Shows how you can append text to TextEdit and how you can use it to display formatted text. See newer examples for how to use slots to edit rich text and new font and color dialogs too.

Functions/concepts: - changeWidetText - RichTextEdit

Command Line

Shows how you can pass parameters to Kommander dialog via command line. Also, shows how to change list content and button text. See the section on passing arguments in the new parser for more on this.

Functions/concepts: - command-line arguments - global - changeWidgetText - addListItem - clearList

Initialize

Shows how you use 'initialization' to 'destroy' scripts of main dialog to initialize and store some settings.

Functions/concepts: - initialization - destroy - readSetting - writeSetting

Array

Shows how to use associative arrays to store and restore information associated with container items.

Functions/concepts: - @Array functions

Strings

Shows how to use string-handling functions Functions/concepts:

- @String functions - rich text editor

Tree

Shows how to use tree widget

- tree widget - FileSelector - initialization - env

Widgets

Shows how to get widget information

- type method - children method

StatusBar

Shows how to use statusbar widget

- statusbar widget - populate

Loop

Shows how to use internal loops

- for - forEach

Calc

Shows how to use @expr function to do some calculations

- expr - String.replace

Note

The @expr() function is no longer required in the new parser as expressions can be directly interpreted anywhere you would logically want to use them.

Picview

Shows how to use PixmapLabel widget using populate() function

- PixmapLabel - populate - FileSelector - slots/connections

Table

Shows how to use Table widget

- insertRow - insertColumn - currentRow - currentColumn - setColumnCaption - setRowCaption - removeRow - removeColumn

Prev
Next
Home


Would you like to comment or contribute an update to this page?
Send feedback to the TDE Development Team