Another new set of features you will get in next thinBasic 1.10.5 is the ability to specify shorter sentences for creating windows and controls and later, when it's the right time, specify the missing information using a simple <object>.<property> notation. This is possible using the new "Name" option that will allow to give a name to Windows and Controls and use that name to reference to specific windows or controls without the need to know windows handle and control IDs
Of course remaining 100% compatible with previous notation.
No need to change anything in your scripts if you do not want.
A script example and a bundled exe can show you how.
uses "ui" begin ControlID %lbl %txt %btnClose %stBar %listbox %progressbar end ControlID '---Create Window and controls using new shot notations '---All the rest of properties can be defined later during window events DIALOG New Pixels, Name frmMain, 0, "Window to demonstrate Named Controls" control add label , name lbl , frmMain.Handle, %lbl , "This is a label" control add textbox , name txt , frmMain.Handle, %txt , "This is a textbox" control add Button , name btnClose , frmMain.Handle, %btnClose , "Close" Control Add Statusbar , name stBar , frmMain.Handle, %stBar , "" DIALOG SHOW MODAL frmMain.Handle '-------------------------------------------- callBack function frmMain_OnCallback() As Long '-------------------------------------------- end Function '-------------------------------------------- callBack function frmMain_OnInit() As Long '-------------------------------------------- long dW, dH '---Define window style frmMain.Style = %WS_DLGFRAME | %DS_CENTER | %WS_CAPTION | %WS_SYSMENU | %WS_OVERLAPPEDWINDOW '---Get desktop size DESKTOP GET SIZE TO dW, dH '---Set Window client size frmMain.cw = 800 frmMain.ch = 600 '---Set window minimum size frmMain.MinSize = 640, 480 '---Center window frmMain.x = (dW - frmMain.cw)/ 2 frmMain.y = (dH - frmMain.ch)/ 2 end Function '-------------------------------------------- callBack function frmMain_OnSize() As Long '-------------------------------------------- '---Set controls locations and size lbl.x = 5: lbl.y = 5: lbl.w = 200: lbl.h = 20 txt.x = 5: txt.y = 25: txt.w = 200: txt.h = 25 btnClose.x = frmMain.cw - 110 btnClose.y = frmMain.ch - 50 - stBar.h btnClose.w = 100 btnClose.h = 40 end function '-------------------------------------------- callback function btnClose_OnClick() '-------------------------------------------- frmMain.End end Function
Bookmarks