Gui programming in Ala7 language

Windows system controls are programmed using Button, TextBox and so on classes. Gui events and handlers are connected by bind instruction. Powerfull str type is very usefull. Whole win32 api is accessible through simple call instruction . It's very easy to create new controls using Control class . So gui programming is easy and intuitive.

Here is an easy example how to use system controls.

import gui from gui_win32.ala 

class MainWindow
	Window window
	TextBox textBox
	Button button
	
MainWindow MainWindow(int x, int y, int w, int h, str title)=
	MainWindow main_window
	main_window.window=Window(x,y,w,h,0,0,0,title)
	client_rect=getClientRect(main_window.window)
	x=20;y=20;h=20;w=100
	main_window.textBox=TextBox(x,y,w,h,0,"text1",main_window.window.id)
	x=20;y=client_rect.h-h-10
	main_window.button=Button(x,y,w,h,0,"new",main_window.window.id)
	bind main_window.button,WM_LBUTTONDOWN,whenButtonNewClicked(main_window) #!!!!!!!!!!!!!!
	return main_window

proc whenButtonNewClicked(MainWindow main_window)
	setText(main_window.textBox,"12345")

initGui() #!!!!!!!!!!!!!!!!!!
main_window=MainWindow(CW_USEDEFAULT,0,CW_USEDEFAULT,0,"window Ala")
show(main_window.window)
eventLoop()

The result is:

To build new, rich gui controls class Control is used.

#Making own component
import gui from gui_win32.ala #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


class DbGrid
	hParent=0
	Control dataWnd
	Control header

DbGrid DbGrid(int x,int y,int w,int headerH,int dataH,int style,int hParent)=		


	dbGrid.header=Control(x,y,dbGrid.width,headerH,newStyle,title,hParent)

	dbGrid.dataWnd=Control(x,y+headerH-1,dbGrid.width,dataH,newStyle,title,hParent)

An example how to use controls with virtual functions

When rich gui application is programmed, like text editor or browser, Ala7 dynamic types like list, strTable and all are wery helpfull. Folowing example shows code for edit control. It was possible to program rich edit control with undo operation in less then 2000 lines of code.

Edit control code example

To change specyfic function for a control virtual functions and bind instruction are used, however in future releases class inheritence is planned.

Ala7 integrated development environment was successully programmed in Ala7 language.