This new project is to show you the use of WinLIFT's custom buttons within FireFly.
Rather than using a CTL file, i am using dummy buttons as template for the creation of the custom buttons, there is new helper function, named "SplitTemplate", to ease the creation of the WinLIFT's buttons and to let them work the FireFly's way.
Function SplitTemplate(ByVal hParent As Dword, ByVal IDC As Long, ByRef x As Long, ByRef y As Long, ByRef w As Long, ByRef h As Long, ByRef sLabel As String, ByRef sImagePath As String, ByRef dwStyle As Dword) As Long
Local rc As Rect, p As PointApi, zString As Asciiz * 1024, hTemplate As Dword, sExt As String
hTemplate = GetDlgItem(hParent, IDC)
x = 0: y = 0: w = 0: h = 0: sLabel = "": sImagePath = ""
If IsWindow(hTemplate) Then
Call GetWindowRect(hTemplate, rc)
p.X = rc.nLeft: p.Y = rc.nTop: Call ScreenToClient(GetParent(hTemplate), p)
x = p.X: y = p.Y: w = rc.nRight - rc.nLeft: h = rc.nBottom - rc.nTop
Call GetWindowText(hTemplate, zString, SizeOf(zString))
If ParseCount(zString) = 2 Then
sLabel = Parse$(zString, 2)
sImagePath = Trim$(Parse$(zString, 1))
If Instr(-1, sImagePath, "\") = 0 Then
sImagePath = Exe.Path$ + "Resource\" + sImagePath
End If
Else
sLabel = RTrim$(zString): sExt = "." + LCase$(Right$(sLabel, 3)) + "."
If Instr(".png.jpg.bmp.gif.tif.", sExt) Then
sImagePath = sLabel
If Instr(-1, sImagePath, "\") = 0 Then
sImagePath = Exe.Path$ + "Resource\" + sLabel
End If
sLabel = ""
End If
End If
dwStyle = GetWindowLong(hTemplate, %GWL_STYLE)
' // We don't need it anymore
Call DestroyWindow(hTemplate)
Function = -1
Else
Function = 0
End If
End Function
All buttons are anchored, use resize or maximize/restore to see it.
...
[attachment deleted by admin]
Amazing....
I always wish that I wasn't so graphically challenged. :)
It isn't too hard with the right tools, many of those standard icons you can download too. I have a bunch just like all but one of the button icons.
When messing around in the other SetFocus thread, I found it an interesting read in http://msdn.microsoft.com/en-us/library/aa511453.aspx
In the "Avoid combining text labels and graphics on command buttons." section M$ pretty much says they recommend not to put images that are just symbols and don't add to the button "comprehension" like they have on most of their own buttons. At first they seem to indicate that the rotate direction aids, but then they go on to say an X for Stop is correct, but one for cancel isn't??? To me X would more likely mean delete and a stop sign or something for stop. Not sure where their logic is, but I like buttons with graphics like this anyway...plain text is just too...plain.