Hello, I'm wondering if this code is understandable enough to somebody that has never used JungleGui module before:
Import junglegui
'This is required by the Events system to work on any file with event handling methods:
#REFLECTION_FILTER+="${MODPATH}"
Class MyForm Extends Form
Field okButton:Button
'This method is called when the Form needs to initialize its conained components:
Method OnInit()
'Create an initialize the Ok button:
okButton = New Button
okButton.AutoAdjustSize = False
okButton.Parent = Self
okButton.Text = "Ok"
okButton.Size.SetValues(200, okButton.Font.GetFontHeight + 20)
okButton.Event_Click.Add(Self, "OkButton_Clicked")
Self.Text = "Untitled dialog"
Self.Event_Resized.Add(Self, "Form_Resized")
DoLayout()
End
'This method handles the Form Resized event,
Method Form_Resized(sender:Object, e:EventArgs)
'Calculate controls layout here:
DoLayout
End
Method OkButton_Clicked(sender:Object, e:MouseEventArgs)
'code to be done when the button is clicked or touched:
End
Method DoLayout()
'Center the sample button at the bottom of the dialog:
okButton.Position.X = Self.ClientSize.X / 2 - okButton.Size.X / 2
okButton.Position.Y = Self.ClientSize.Y - okButton.Size.Y
End
End It's a Form code that has a button that does nothing, but keeps the button aligned at the bottom center of the form.
I'm creating some document templates for JungleGui but, as I'm the module developer, sometimes I lose the track if things are too complicated to get without more comments, or not.
I guess it's rather easy for anyone with a minimum of experience on WindowsForms (that's the syntax I'm getting as inspiration for nomenclature, etc.)
|