Update extensions/ringlibui/test.ring - Better Code
@@ -2,29 +2,26 @@ load "libui.ring"
oWindow = uiNewWindow( "Hello, World", 400, 400, True)
-uiControlShow( oWindow )
-
btn1 = uiNewButton("SayHello")
+uiButtonOnClicked(btn1,"sayHello()")
+
btn2 = uiNewButton("Close")
+uiButtonOnClicked(btn2,"closeApp()")
g = uiNewGrid() uiGridSetPadded(g, 1) uiWindowSetChild(oWindow, g)
-
uiGridAppend(g, btn1, 0, 0, 2, 1, 1, uiAlignFill, 0, uiAlignFill)
-
uiGridAppend(g, btn2, 0, 1, 1, 1, 1, uiAlignFill, 0, uiAlignFill)
-uiWindowOnClosing(oWindow,"closeapp()")
-uiButtonOnClicked(btn1,"one()")
-uiButtonOnClicked(btn2,"two()")
+uiWindowOnClosing(oWindow,"closeApp()")
+
+uiControlShow( oWindow )
uiMain()
+func sayHello
+ uiMsgBox(oWindow,"Hi","Hello")
+
func closeApp
uiControlDestroy(oWindow)
shutdown(0)
-func one
- uiMsgBox(oWindow,"Hi","Hello")
-
-func two
- closeApp()
