blizzard::gui — File Browser

blizzardguiv1.0 / blizzardguiv1.0 / blizzard_gui_example2.mrc

blizzard_gui_example2.mrc — 2.13 KB — Download this file

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

;                       blizzard::gui - Example 2
;                       ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
;

;     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_example2 {
  gui example2 my_2nd_table
}

on *:LOAD:echo -a blizzard::gui example script 2 loaded. /gui_example2 to run it.

;GUI table: "my_2nd_table"

alias tgui_my_2nd_table {
  ;set the size and title
  gui_size example2 200 200 320 200
  gui_title example2 blizzard::gui - My Second Example

  ;create a richedit control (display) and an editbox
  gui_text example2 1 4 4 160 16 > Example of chat window :
  gui_richedit example2 2 4 22 290 100 autovs vsbar
  gui_edit example2 3 4 134 220 16 autohs
  gui_button example2 4 234 130 60 24 > Send !

  ;color the richedit with the background color of mIRC
  gid -k example2 2 $color($color(background)) $color($color(own text))

  ;echo a join in the richedit
  gid -a example2 2  $+ $color(join) $+ $timestamp ››› $me has joined #example_chat
  gid -a example2 2  $+ $color(join) $+ $timestamp ››› Blizzard has joined #example_chat

  ;display a line in the editbox
  gid -a example2 3  Hello Blizzard :)
}

; Events processing

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

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

      ;Send button
      if ($3 == 4) {
        gid -a example2 2  $+ $color(own text) $+ $timestamp < $+ $me $+ > $gid(example2,3)
        gid -r example2 3
        gid -b example2 4
      }
    }
    ;if the user is typing text in the editbox
    else if ($2 == edit) && ($3 == 3) {

      ;if there is no text, we disable the button
      if (!$gid(example2,3)) gid -b example2 4
      ;else, if the button is disabled we enable it
      else if ($gid(example2,4).enabled == 0) gid -e example2 4 
    }
  }
}