@Petr,
You're welcome.
@John Spikowski,
Is it ? I never tried it. In fact, i am making one with win api nim. There is guy named ward(forum name) made a huge library of win api wrapper. It's called "winim". With winim, its very easy to code win api functions. Here are some samples.
import GuiLib '# My Gui Library header file. It contains all necessary modules.
'# This Application class will do the initial jobs such as getting the hInstance.
'# You can pass a string for your window class name. It's optional.
var app = Application("Window-Nim")
'# Forward declarations.
proc OnFormCreate( e : eventArgs)
proc OnLoad( e : eventArgs)
proc OnNCCreate(e : eventArgs)
proc OnButtonClick( e : eventArgs)
proc OnButtonClick2( e : eventArgs)
proc b1OnMouseEnter( e : eventArgs)
proc OnClosing( e : eventArgs)
proc OnSetFocus( e : eventArgs)
proc OnKillFocus( e : eventArgs)
proc OnMouseLeave_cbt(e : eventArgs)
proc OnMouseMove_Cal(e : eventArgs)
proc OnClick_CustomBTN(e : eventArgs)
'# Creating an instance of a form class. We need to pass the Application object as parameter--
'# -- in order to get the hInstance and other stuff.
var Form1 = NewForm(app)
'# RegisterMsg is for handling wm_create msg. I can't find a better way to do this.
Form1.RegisterMsg(WM_CREATE, OnFormCreate)
'# Now we are creating the form. If you want to set the for properties, you can--
'# --set it like this.
'# Form1.posx = 150
'# Form1.posy = 200
'# Form1.width = 800
'# Form1.height = 600
'# Form1.text = "My Nim Window"
'# But i am using default values here.
Form1.CreateForm()
'# Create some control classes
var
b1, b2 = Button()
lv = ListView()
cal = Calendar()
ud = UpDown()
dtp = DateTimePicker()
trb = TrackBar()
red = RichEdit()
cbt = CustomButton()
'# Here you can add handler functions to control events lile click, mouse move etc.
b1.AddHandler(b1.event.click, OnButtonClick)
b2.AddHandler(b2.event.click, OnButtonClick2)
b2.AddHandler(b2.event.mouseLeave, b2_OnMouseLeave)
b1.AddHandler(b1.event.mouseEnter, b1OnMouseEnter)
Form1.AddHandler(Form1.event.mouseRightUp, OnDblClk_Form1)
Form1.AddHandler(Form1.event.closing, OnClosing)
Form1.AddHandler(Form1.event.load, OnLoad)
Form1.AddHandler(Form1.event.setFocus, OnSetFocus)
Form1.AddHandler(Form1.event.killFocus, OnKillFocus)
cal.AddHandler(cal.event.mouseEnter, OnMouseMove_Cal)
red.AddHandler(red.event.mouseLeave, OnMouseLeave_Red)
cal.AddHandler(cal.event.mouseHover,OnMouseHover_Cal)
cbt.AddHandler(cbt.event.click, OnClick_CustomBTN)
cbt.AddHandler(cbt.event.mouseLeave, OnMouseLeave_cbt)
'# Now, we can set the control properties.
b2.posx =140
b2.posy = 10
b2.text = "My Button"
b2.width = 150
b2.font.name = "Calibri" '# Tahoma is default
b2.font.size = 12
lv.posx = 350
lv.posy = 10
lv.width = 300
cal.posx = 350
cal.posy = 10
ud.posx = 350
ud.posy = 320
'# See, custom button class has so many color properties.
cbt.posx= 350
cbt.posy= 220
cbt.text = "Owner Drawn BTN"
cbt.backColor = NewColor(80, 16, 44) '# NewColor function receives RGB values and returns a COLORREFF
cbt.foreColor = NewColor(15, 15, 80)
cbt.hoverBackColor = cbt.backColor
cbt.hoverForeColor = NewColor(238,20,49)
cbt.width = 200
cbt.height = 80
dtp.posx = 150
dtp.posy = 150
trb.posx = 150
trb.posy = 120
red.posx = 10
red.posy = 200
'# Now we can create our controls.
b1.CreateButton()
b2.CreateButton()
cal.CreateCalendar()
ud.CreateUpDown()
dtp.CreateDateTimePicker()
trb.CreateTrackBar()
red.CreateRichEdit()
cbt.CreateCustomButton()
# Let's display our form
Form1.ShowForm()
'# This is the main loop.
app.Run()
'# Now, these are the event handler function area.
'# Argument "e" is a structure. It contains all necessary elements to handle the--
'# --WndProc function
proc OnCreate( e : eventArgs) =
echo "Window created....."
echo e.handle '# e.handle is the window HWND
proc OnLoad( e : eventArgs) =
echo "Window Loaded...."
proc OnButtonClick( e : eventArgs) =
b2.text = "Changed Text"
proc OnButtonClick2( e : eventArgs) =
msgBox("A Message")
proc b1OnMouseEnter( e : eventArgs) =
echo "Mouse entered on button 1"
proc b2_OnMouseLeave( e : eventArgs) =
echo "Mouse leaved from Button 2"
proc OnNCCreate( e : eventArgs) =
echo "NC CREATE handled"
proc OnClosing( e : eventArgs) =
echo "Form is closing..."
proc OnSetFocus( e : eventArgs) =
echo "Form is in focus...."
proc OnKillFocus( e : eventArgs) =
echo "Form lost focus...."
proc OnMouseLeave_cbt(e : eventArgs) =
echo "Mouse leaved from Custom button..."
proc OnMouseMove_Cal(e : eventArgs) =
echo "Mouse hovered over Calendar..."
proc OnMouseLeave_Red(e : eventArgs) =
echo "Mouse leave from Rich Edit..."
'# End
Bookmarks