domingo, 16 de septiembre de 2012

Dialog creation

S2 allows you to easy create dialog by using a provided class, the same consider the buttoms are arranged by rows for example if you like to add a row of controls then

1- allways create an empty list
structure = list()

2- define the structure of the buttoms

txt1= ['StaticText', ['row 1----']]
txt2= ['StaticText', ['row 2----']]
txt3= ['StaticText', ['row2 col2----']]
btn1= ['Choice',     [['opt 1',  'opt 2']]]


3- add the buttoms to the list by rows

structure.append( [txt1])
structure.append( [txt2, txt3])
structure.append( [btn1])


4- send the list created to the dialog class
myDialog= dialog(struct= structure)

5- display the dialog and take the value of the controls
if myDialog.ShowModal() == OK: # if the user press the ok button
  values= myDialog.GetValue()
  show(values)
  myDialog.Destroy()  # destroy the dialog
  show("the user press OK button")
else:
  show("The user press CANCEL button")

The resulting dialog is




No hay comentarios.:

Publicar un comentario