blizzard::gui — File Browser

blizzardguiv1.0 / blizzardguiv1.0 / blizzard_gui_example1.mrc

blizzard_gui_example1.mrc — 1.94 KB — Download this file

;===================================================================================================

;                       blizzard::gui - Example 1
;                       ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
;

;     This file is not needed if you want the engine to work.
;
;     Made by Epsilon - July 2003

;     www.blizzard.be.tf
;     

;===================================================================================================

;alias to call the GUI

alias gui_example1 {
  gui example1 my_first_table
}
on *:LOAD:echo -a blizzard::gui example script 1 loaded. /gui_example1 to run it.

;GUI table: "my_first_table"

alias tgui_my_first_table {
  ;set the size and title
  gui_size example1 200 200 220 190
  gui_title example1 blizzard::gui - My First Example

  ;create some controls
  gui_text example1 1 4 4 120 16 > Type some text here :
  gui_edit example1 2 4 22 120 16 autohs > blah !
  gui_list example1 3 4 52 120 120 vsbar autovs 
  gui_button example1 4 135 18 60 24 > Add
  gui_button example1 5 135 52 60 24 > Delete
  gui_button example1 6 135 121 60 24 > Exit

  ;disable the delete button
  gid -b example1 5
}

; Events processing

on *:SIGNAL:GUI: {
  ;if the GUI is "example1"
  if ($1 == example1) {

    ;if the event is a single click
    if ($2 == sclick) {

      ;If this is the Add button, we add the editbox text in the list
      if ($3 == 4) { 
        gid -a example1 3 $gid(example1,2)
        gid -r example1 2
      }
      ;If this is the Exit button, we close the GUI
      else if ($3 == 6) gui -c example1
      ;If this is the Delete button, we delete the selected line and we disable the button
      if ($3 == 5) { 
        gid -d example1 3 $gid(example1,3).sel
        gid -b example1 5
      }
      ;If this is the Listbox and if an item is selected, we enable the Delete buttton
      else if ($3 == 3) && ($gid(example1,3).sel) gid -e example1 5
    }
  }
}