wxBasicscript-Help

noframes
Autostartmanager - Step 1
The first window
Our example will create a list with more than the "ok" and "cancel" -buttons.
It is a small program, that allows you to add programs to a "autostart"-file, that will be executed when the X-Window-System starts.
This example also demonstrates several file-functions of basefunctions.inc.
This is the code for the template:
autostart.tpl

    Autostart_Manager='

    <frame existing entries>

        <list>
          <variable>LIST1</variable>
          <width>400</width>
          <height>300</height>
        </list>

        <button>
          <label>Exit</label>
           <action>EXIT=EXIT</action>
        </button>

    </frame>
    '

We also need a wxbs to display the template:
autostart.wxbs

    #!/usr/bin/wxbasicscript
    include "/usr/lib/wxbasicscript/basefunctions.inc"
    shell( "cd " & STARTDIR )

    //-- generate the GTK-Dialog --

    dialog = readtemplate( STARTDIR & "/autostart.tpl" )
    choice = gtkdialog2 ( dialog )

    xmessage ( "-nearmouse Returnvalue from Gtkdialog was: " & choice )

I use gtkdialog2, which is new in Puppy 1.0.5, and has several enhancements to the older version.
The line with "cd" makes shure, we are in the folder, the script resides in.
So it is assured, it will find its resourcefiles.
If you run the example, you will see an empty list, with an exit-button.
In order something can happen, when you click the button, it is assigned an "action".
The action is an internal Gtkdialog-command to exit the dialog.
You also see, that you just have to set the size of the list.
The button automatically will adapt its size, if you resize the window.
Gtkdialog just returns 1 value choice.
It is the Exit-String of the dialog.
If you exit with the button, it will be "EXIT".
If you exit by using the "close" symbol of the Window-Title, it will be "abort".
There also is a line

    <variable>LIST1</variable>

This is not used yet, but we need it for the next steps.