Difference between revisions of "Dialog basics"

From Scriptwiki
Jump to: navigation, search
m
m
Line 53: Line 53:
  
 
The -l switch makes a dialog table local, so that it can only be accessed by other scripts in the same file.
 
The -l switch makes a dialog table local, so that it can only be accessed by other scripts in the same file.
 +
 +
'''Example'''
 +
;create a dialog table with name 'dialogtest'
 +
dialog dialogtest {
 +
 +
  ;set the titlebar text of the dialog to "testing dialog"
 +
  title "testing dialog"
 +
 +
  ;define the position and size of the dialog, x and y set to -1 so the dialog is created to the middle of mirc window, width set to 150 and height to 200
 +
  size -1 -1 150 200
 +
 +
  ;dpu, dialog basic units, so the dialog will be the same size in every resolution
 +
  option dbu
 +
 +
  ;a text item that says "Random text", assigning id 1 for the item, x=5, y=10, w=100, h=10, no style
 +
  text "Random text", 1, 5 10 100 10,
 +
}
 +
 +
;now you can call this dialog by writing: /dialog -m dialogtest dialogtest

Revision as of 12:18, 24 August 2006

Basic dialog commands and switches

/dialog -mdtsonkcvie name [table] [x y w h] [text]
Where name is the name by which you'll refer to the dialog, and table is the dialog table name used to create dialog

 -m	create a modeless dialog using 'table' /dialog -m name table
 -a	used with -m, uses currently  active window as the parent
 -x	close a dialog without triggering any events
 -d	open dialog on the desktop, used with -m
 -h	make dialog work with active server connection
 -t	set dialog title /dialog -t name text
 -s	set dialog size/pos /dialog -s name x y w h
 -r	centers dialog
 -bp	interprets size as dbu or pixels
 -o	set dialog ontop of all windows
 -n	unset ontop setting
 -k	click ok button
 -c	click cancel button
 -v	makes the dialog the active window
 -ie	minimize/restore the dialog if created on the desktop

The dialog table You can use the dialog prefix to create a dialog table called name in a script using this format:

dialog [-l] name {
 title	"text"
 icon	filename, index
 size	x y w h
 option	type (dbu, pixels, notheme)
 
 text	"text", id, x y w h, style  (right, center, nowrap)
 edit	"text", id, x y w h, style  (right, center, multi, pass, read, return, hsbar, vsbar, autohs, autovs, limit N)
 button	"text", id, x y w h, style  (default, ok, cancel, flat, multi)
 check	"text", id, x y w h, style  (left, push, 3state)
 radio	"text", id, x y w h, style  (left, push)
 box	"text", id, x y w h, style
 scroll	"text", id, x y w h, style (top left bottom right horizontal range N N)
 
 list	id, x y w h, style          (sort, extsel, multsel, size, vsbar, hsbar, check, radio)
 combo	id, x y w h, style          (sort, edit, drop, size, vsbar, hsbar)
 
 icon	id, x y w h, filename, index, style    (noborder top left bottom right small large actual)
 
 link	"text", id, x y w h
 
 tab 	"text", id, x y w h
 tab	"text", id
 
 menu	"text", menuid [, menuid]
 item	"text", id [, menuid]
 item	break, id [, menuid]
}

The -l switch makes a dialog table local, so that it can only be accessed by other scripts in the same file.

Example

;create a dialog table with name 'dialogtest'
dialog dialogtest {
 ;set the titlebar text of the dialog to "testing dialog"
 title "testing dialog"
 ;define the position and size of the dialog, x and y set to -1 so the dialog is created to the middle of mirc window, width set to 150 and height to 200 
 size -1 -1 150 200
 ;dpu, dialog basic units, so the dialog will be the same size in every resolution
 option dbu
 ;a text item that says "Random text", assigning id 1 for the item, x=5, y=10, w=100, h=10, no style
 text "Random text", 1, 5 10 100 10, 
}

;now you can call this dialog by writing: /dialog -m dialogtest dialogtest