some examples:
qbutton_test.bas
Code: Select all
#include once "../gui/kogaion_gui_standards.bas"
dim shared as QForm Form1
dim shared as QButton QButton2
sub BClick(sender as QObject)
ShowMessage(sender.ClassName)
end sub
QButton2.Parent=Form1
QButton2.SetBounds(102,36,150,36)
QButton2.Text="Click me!"
QButton2.onClick=@BClick
Form1.SetBounds(6,129,400,143)
Form1.Parent=0
application.run
Code: Select all
#include once "../gui/kogaion_gui_standards.bas"
type QForm1 extends QForm
as QButton Button
declare static sub ButtonClick(sender as QObject)
declare static sub FormClose(sender as QObject,byref action as integer)
declare constructor
end type
sub QForm1.ButtonClick(sender as QObject)
if MessageDlg("Enable " &sender.ClassName &"?","Application",mb_iconinformation or mb_yesno)=idno then
Q_Button(sender).Enabled=0
end if
end sub
sub QForm1.FormClose(sender as QObject,byref action as integer)
select case MessageDlg("Close for sure?","Application",mb_iconquestion or mb_yesno)
case idyes :action=1:application.Terminate
case idno:action=0
end select
end sub
constructor QForm1
Button.Parent=@this
Button.Text="Click me!"
Button.onClick=@ButtonClick
OnClose=@FormClose
SetBounds(120,120,550,250)
Parent=0
end constructor
var Form=QForm1
application.run
Code: Select all
'compile as .dll file
#include once "../gui/kogaion_gui_standards.bas"
type QForm1 extends QForm
as QButton Button
declare static sub ButtonClick(sender as QObject)
declare static sub FormClose(sender as QObject,byref action as integer)
declare operator cast as any ptr
declare constructor
end type
sub QForm1.ButtonClick(sender as QObject)
if MessageDlg("Enable " &sender.ClassName &"?","Application",mb_iconinformation or mb_yesno)=idno then
Q_Button(sender).Enabled=0
end if
end sub
sub QForm1.FormClose(sender as QObject,byref action as integer)
select case MessageDlg("Close for sure?","Application",mb_iconquestion or mb_yesno)
case idyes :action=1:application.Terminate
case idno:action=0
end select
end sub
operator QForm1.cast as any ptr
return @this
end operator
constructor QForm1
Parent=0
Button.Parent=@this
Button.Text="Click me!"
Button.onClick=@ButtonClick
OnClose=@FormClose
this.SetBounds(120,120,550,250)
this.visible=1
end constructor
''''
dim shared as QForm1 ptr F
sub init constructor
QForm.Register
QButton.Register
F=new QForm1
end sub
application.run
'''mangled export
function DllForm as QForm1 ptr export
return F
end function
Code: Select all
#include once "windows.bi"
dim shared as hmodule dll=0
dll=dylibload("QForm_dll.dll"):
if dll then
messagebox(0,"dll is loaded.","Application",0)
else
? GetLastError
end if
dylibfree(dll)