Powerbasic Museum 2020-B

IT-Consultant: Patrice Terrier => WinLIFT => Topic started by: Jim Padgett on November 22, 2010, 10:42:14 PM

Title: Winlift and Firefly v3
Post by: Jim Padgett on November 22, 2010, 10:42:14 PM
I have gotten winlift to skin my app, but the left, right and bottom of the form don't show the skin unles I grab the resize handle and size the window just a little larger.

Winlift is pretty easy to use so far.. but dummys like me sure have to read a bit to use it... it does look good though...

I guess I'm allright putting the skInitEngine (  in the WM_CREATE of the form ) ?
Title: Re: Winlift and Firefly v3
Post by: Patrice Terrier on November 23, 2010, 10:18:52 AM
I have posted several FireFly examples on the planetsquires forum.

For your convenience i have attached the fonts.zip project to this post.
It shows you how to use WinLIFT's custom controls in FireFly.

See the screen shot here. (http://www.jose.it-berater.org/smfforum/index.php?topic=3629.msg11865#msg11865)

And here is an example of code to use with FireFly:


Function MAIN_WM_CREATE ( _
                       hWndForm As Dword, _      ' handle of Form
                       ByVal UserData As Long _  ' optional user defined Long value
                       ) As Long

   If skInitEngine("Onyx.sks", "") Then

      Local hTemplate, hCtrl, dwStyle As Dword, x, y, w, h As Long
      Local sLabel, sImagePath As String, zTooltip As Asciiz * 128  

      Call skSkinWindow(hWndForm, "Dock|Undock|Minimize|Maximize|Restore|Close")
     
'      // Note: Always use the WinLIFT's anchor mode,
'      // because FireFly ResizeRules are limited, and they do not work with the SkinEngine.    

      zTooltip = "WinLIFT PushButtonImage"

'      // Create the WinLIFT PushButtonImage, from the template.        
      If SplitTemplate(hWndForm, IDC_MAIN_BTNCHECK, x, y, w, h, sLabel, sImagePath, dwStyle) Then
         hCtrl = skPushButtonImage(hWndForm, (sImagePath), (sLabel), x, y, w, h, IDC_MAIN_BTNCHECK, dwStyle)  
'         // Anchor the button
         Call skSetAnchorCtrl(hCtrl, %ANCHOR_CENTER_HORZ)          
         Call skCreateToolTip(hCtrl, zTooltip)
'         // Assign the local hCtrl to the FF3 global handle          
         HWND_MAIN_BTNCHECK = hCtrl
      End If

'      // Create the WinLIFT PushButtonImage, from the template.        
      If SplitTemplate(hWndForm, IDC_MAIN_BTNDELETE, x, y, w, h, sLabel, sImagePath, dwStyle) Then
         hCtrl = skPushButtonImage(hWndForm, (sImagePath), (sLabel), x, y, w, h, IDC_MAIN_BTNCHECK, dwStyle)  
'         // Anchor the button
         Call skSetAnchorCtrl(hCtrl, %ANCHOR_CENTER_HORZ)          
         Call skCreateToolTip(hCtrl, zTooltip)
'         // Assign the local hCtrl to the FF3 global handle          
         HWND_MAIN_BTNDELETE = hCtrl
      End If

'      // Create the WinLIFT PushButtonImage, from the template.        
      If SplitTemplate(hWndForm, IDC_MAIN_BTNRECYCLE, x, y, w, h, sLabel, sImagePath, dwStyle) Then
         hCtrl = skPushButtonImage(hWndForm, (sImagePath), (sLabel), x, y, w, h, IDC_MAIN_BTNRECYCLE, dwStyle)  
'         // Anchor the button
         Call skSetAnchorCtrl(hCtrl, %ANCHOR_CENTER_HORZ)          
         Call skCreateToolTip(hCtrl, zTooltip)
'         // Assign the local hCtrl to the FF3 global handle          
         HWND_MAIN_BTNRECYCLE = hCtrl
      End If

'      // Create the WinLIFT PushButtonImage, from the template.        
      If SplitTemplate(hWndForm, IDC_MAIN_BTNPRINT, x, y, w, h, sLabel, sImagePath, dwStyle) Then
         hCtrl = skPushButtonImage(hWndForm, (sImagePath), (sLabel), x, y, w, h, IDC_MAIN_BTNPRINT, dwStyle)  
'         // Anchor the button
         Call skSetAnchorCtrl(hCtrl, %ANCHOR_CENTER)          
         Call skCreateToolTip(hCtrl, zTooltip)
'         // Assign the local hCtrl to the FF3 global handle          
         HWND_MAIN_BTNPRINT = hCtrl
      End If

'      // Create the WinLIFT PushButtonImage, from the template.        
      If SplitTemplate(hWndForm, IDC_MAIN_BTNTEXTONLY, x, y, w, h, sLabel, sImagePath, dwStyle) Then
         hCtrl = skPushButtonImage(hWndForm, (sImagePath), (sLabel), x, y, w, h, IDC_MAIN_BTNTEXTONLY, dwStyle)  
'         // Anchor the button
         Call skSetAnchorCtrl(hCtrl, %ANCHOR_CENTER)          
         Call skCreateToolTip(hCtrl, zTooltip)
'         // Assign the local hCtrl to the FF3 global handle          
         HWND_MAIN_BTNTEXTONLY = hCtrl
         Call skSetLabelFont(hCtrl, "Pristina", 28, skARGB(255, 255,255,0), %FontStyleRegular)
      End If
     
     
      Call skSetLabelFont(HWND_MAIN_ROMAN, "Times New Roman", 20, skARGB(255, 255,0,0), %FontStyleRegular)
         Call skSetAnchorCtrl(HWND_MAIN_ROMAN, %ANCHOR_CENTER)          
      Call skSetLabelFont(HWND_MAIN_ARIAL, "Arial", 24, skARGB(255, 255,255,0), %FontStyleBoldItalic)
         Call skSetAnchorCtrl(HWND_MAIN_ARIAL, %ANCHOR_CENTER)          
      Call skSetLabelFont(HWND_MAIN_MISTRAL, "Mistral", 70, skARGB(255, 255,255,255), %FontStyleRegular)
         Call skSetAnchorCtrl(HWND_MAIN_MISTRAL, %ANCHOR_CENTER)          

'      // Create the WinLIFT PushButtonImage, from the template.        
      If SplitTemplate(hWndForm, IDC_MAIN_BTNSAVE, x, y, w, h, sLabel, sImagePath, dwStyle) Then
         hCtrl = skPushButtonImage(hWndForm, (sImagePath), (sLabel), x, y, w, h, IDC_MAIN_BTNSAVE, dwStyle)  
'         // Anchor the button
         Call skSetAnchorCtrl(hCtrl, %ANCHOR_CENTER)          
         Call skCreateToolTip(hCtrl, zTooltip)
'         // Assign the local hCtrl to the FF3 global handle          
         HWND_MAIN_BTNSAVE = hCtrl
      End If


'      // Create the WinLIFT ClockControl, from the template.        
      If SplitTemplate(hWndForm, IDC_MAIN_BTNCLOCK, x, y, w, h, sLabel, sImagePath, dwStyle) Then
         hCtrl = skClockCtrl(hWndForm, (sImagePath), x, y, 0, 0, IDC_MAIN_BTNCLOCK, &H7FCB0000, &H7F8F8F8F, 0)
'         // Anchor the clock to the bottom left.            
         Call skSetAnchorCtrl(hCtrl, %ANCHOR_BOTTOM)
         Call skCreateToolTip(hCtrl, "WinLIFT clock control")
'         // Assign the local hCtrl to the FF3 global handle          
         HWND_MAIN_BTNCLOCK = hCtrl
      End If

      zTooltip = "WinLIFT ButtonImage"

'      // Create the WinLIFT ButtonImage, from the template.        
      If SplitTemplate(hWndForm, IDC_MAIN_BTNLEFT, x, y, w, h, sLabel, sImagePath, dwStyle) Then
         hCtrl = skButtonImage(hWndForm, (sImagePath), x, y, IDC_MAIN_BTNLEFT, 5)  
'         // Anchor the button
         Call skSetAnchorCtrl(hCtrl, %ANCHOR_CENTER_HORZ_BOTTOM)          
         Call skCreateToolTip(hCtrl, zTooltip)
'         // Assign the local hCtrl to the FF3 global handle          
         HWND_MAIN_BTNLEFT = hCtrl
      End If
'      // Create the WinLIFT ButtonImage, from the template.        
      If SplitTemplate(hWndForm, IDC_MAIN_BTNPLAY, x, y, w, h, sLabel, sImagePath, dwStyle) Then
         hCtrl = skButtonImage(hWndForm, (sImagePath), x, y, IDC_MAIN_BTNPLAY, 5)  
'         // Anchor the button
         Call skSetAnchorCtrl(hCtrl, %ANCHOR_CENTER_HORZ_BOTTOM)          
         Call skCreateToolTip(hCtrl, zTooltip)
'         // Assign the local hCtrl to the FF3 global handle          
         HWND_MAIN_BTNPLAY = hCtrl
      End If
'      // Create the WinLIFT ButtonImage, from the template.        
      If SplitTemplate(hWndForm, IDC_MAIN_BTNRIGHT, x, y, w, h, sLabel, sImagePath, dwStyle) Then
         hCtrl = skButtonImage(hWndForm, (sImagePath), x, y, IDC_MAIN_BTNRIGHT, 5)  
'         // Anchor the button
         Call skSetAnchorCtrl(hCtrl, %ANCHOR_CENTER_HORZ_BOTTOM)
         Call skCreateToolTip(hCtrl, zTooltip)
'         // Assign the local hCtrl to the FF3 global handle          
         HWND_MAIN_BTNRIGHT = hCtrl
      End If

'      // Create the WinLIFT ButtonImage, from the template.        
      If SplitTemplate(hWndForm, IDC_MAIN_BTNIMAGE, x, y, w, h, sLabel, sImagePath, dwStyle) Then
         hCtrl = skButtonImage(hWndForm, (sImagePath), x, y, IDC_MAIN_BTNIMAGE, 5)  
'         // Anchor the button
         Call skSetAnchorCtrl(hCtrl, %ANCHOR_BOTTOM_RIGHT)          
         Call skCreateToolTip(hCtrl, zTooltip)
'         // Assign the local hCtrl to the FF3 global handle          
         HWND_MAIN_BTNIMAGE = hCtrl
      End If
     
   End If

End Function


...
Title: Re: Winlift and Firefly v3
Post by: Jim Padgett on November 23, 2010, 02:02:22 PM
Thanks Patrice ... even though the winlift.inc isn't too extensive.. I don't program enough too readily understand by reading them..

I've been spoiled by FFly and I don't program much and none professionally so I'm not current anymore on programming..

I do love your winlift product though and I'm experimenting with it now to determine if I want to add it to my toolbox.
Title: Re: Winlift and Firefly v3
Post by: Jim Padgett on November 29, 2010, 06:50:45 PM
If I hide a textbox on my dialog the background shows , but there is an outline of the textbox still visible on the form.

I have tried to disable skinning of the textbox and redrawing the form with no change...
The command buttons disappear completly, but the text boxes show the outline.

Also I have an icon specified in the project and it shows on the caption fine unless the form is skinned, then I get the default icon.

I have also set a $REG = "myregistrationinfo" in the winlift.inc file ...  I guess it is all right to do that.

Any ideas ?

Function FORM1_WM_CREATE ( _
                         hWndForm As Dword, _      ' handle of Form
                         ByVal UserData As Long _  ' optional user defined Long value
                         ) As Long


If skInitEngine("C:\WinLIFT\Robot.sks", $REG) Then     
    skSkinWindow(hWndForm , "Dock|Undock|Minimize|Maximize|Restore|Close")

End If                                                       

                         FF_Control_ShowState HWND_FORM1_COMMAND1, %SW_HIDE
                         FF_Control_ShowState HWND_FORM1_COMMAND2, %SW_HIDE
                         FF_Control_ShowState HWND_FORM1_TEXT1,%SW_HIDE
                         FF_Control_ShowState HWND_FORM1_TEXT2,%SW_HIDE
                         FF_Control_ShowState HWND_FORM1_TEXT3,%SW_HIDE
                         FF_Control_ShowState HWND_FORM1_TEXT4,%SW_HIDE
                         FF_Control_ShowState HWND_FORM1_TEXT5,%SW_HIDE
Title: Re: Winlift and Firefly v3
Post by: Patrice Terrier on November 29, 2010, 08:34:37 PM
Jim,

The icon shown on the WinLIFT caption, is not the icon of your application, but the icon of the theme.

What you should do is to create a PNG file matching your icon and copy it, into the skin folder under the name ICON.PNG.

And in the matching SKS file, rename ICON.ski as ICON.png
like this
"ICON_PROG,           @PATH@Sony\ICON.ski"      ' 4.38
into
"ICON_PROG,           @PATH@Sony\ICON.png"      ' 4.38


>> If I hide a textbox on my dialog the background shows , but there is an outline of the textbox still visible on the form.
This is because WinLIFT draws a skBorder around the Edit control, the border control is a child of the edit control, thus you must hide/show it as well.
I shall see if i can handle this transparently for you.

>>I have also set a $REG = "myregistrationinfo" in the winlift.inc file ...  I guess it is all right to do that.
No, because it could be overwritten by a new version, it is better to put it in a distinct include file.

...







Title: Re: Winlift and Firefly v3
Post by: Patrice Terrier on November 29, 2010, 09:02:00 PM
Jim,

See the attached WinLIFT version 4.88, that should hide/show the skBorder automatically.

...
Title: Re: Winlift and Firefly v3
Post by: Jim Padgett on November 29, 2010, 10:57:54 PM
Many Thanks...  border is gone ...   8)
Title: Re: Winlift and Firefly v3
Post by: Jim Padgett on November 30, 2010, 01:32:16 AM
How do you change the text color of a skinned textbox ?
Title: Re: Winlift and Firefly v3
Post by: Patrice Terrier on November 30, 2010, 09:12:27 AM
You must edit the ARGB color in the "Color section" of the SKS file.

A SKS file, is similar to a Cascading Style Sheets for HTML files.
It can be be edited with any ascii Text editor.


'COLOR section --------------------------------------------------------------
"CAPTIONTEXT,         255,255,255,255" ' RGB active caption text color.
"INACTIVECAPTIONTEXT, 255,110,113,117" ' RGB inactive caption text color.
"ACTIVECAPTION,       255,224,223,227" ' RGB active caption background color.
"INACTIVECAPTION,     255,235,235,235" ' RGB inactive caption background color.
"BTNTEXT,             255,255,255,255" ' RGB font color to use in button.
"POPMENUTEXT,         255,0,0,0"       ' RGB PopMenu and Status text color.
"POPMENUHILITE,       255,196,196,196" ' RGB PopMenu 3D color.
"WINDOWTEXT,          255,230,230,230" ' RGB default main window text color.
"HILITEBACK,          255,209,209,209" ' RGB active item background in control.
"HILITETEXT,          255,64,64,64"    ' RGB active item text in control.
"ACTIVMENU,           255,255,255,255" ' RGB active menu bar text color.
"INACTIVMENU,         255,133,138,133" ' RGB inactive menu bar text color.
"MENUBARHILITE,       255,255,255,255" ' 4.35 RGB menu bar hilite.
"GRAYEDCOLOR,         255,128,128,128" ' 4.53 for grayed text control.

"3DLEFTTOP,           255,58,58,58"    ' RGB skDrawRect3D left top color.
"3DRIGHTBOTTOM,       255,126,126,126" ' RGB skDrawRect3D right bottom color.
 
"CARETCOLOR,          255,128,0,0"     ' 4.36+ RGB caret color.
"EDITCOLORTEXT,       255,255,255,255" ' 4.01+ RGB Edit text color.
"EDITCOLORBACK,       255,110,113,117" ' 4.01+ RGB Edit background color. 255,110,113,117
"EDITCOLORRECTUP,     255,192,192,192" ' 4.01+ RGB Edit frame top/left color.
"EDITCOLORRECTDOWN,   255,192,192,192" ' 4.01+ RGB Edit frame bottom/right color.
"MENUBORDERFRAME,     255,32,32,32"    ' 4.01+ RGB Menu frame border color.

"TBTRACKCOLOR,        255,160,160,160" ' 4.26 Track bar hilight color
"TBPOSCOLOR,          255,0,74,201"    ' 4.26 Track bar progress color

"SHADOW,              255,32,32,32"    ' RGB shadow item translucent color. 128,128,128
"TRANSLUCENCY,        70"              ' Shadow translucency.

"MENUTRANSLUCENCY,    90"              ' Menu translucency percentage

"DWM_AERO,             0"              ' 0 = OFF, 1 = ON (Use VISTA-SEVEN Aero composited mode)
"DWM_LEFT,            00"              ' DWM left border size.
"DWM_TOP,             00"              ' DWM top border size.
"DWM_RIGHT,           00"              ' DWM right border size.
"DWM_BOTTOM,          00"              ' DWM bottom border size.
Title: Re: Winlift and Firefly v3
Post by: Jim Padgett on November 30, 2010, 11:18:26 AM
I was thinking about changing text color based on conditions in my program something like:

If text$ = "not found" then change text color to red .

With the application skinned I can't change the color using FF_Control_SetColor ( HWND_FORM1_TEXT1, %Red, -1)

Title: Re: Winlift and Firefly v3
Post by: Patrice Terrier on November 30, 2010, 11:51:28 AM
FireFly is using RGB colors, while WinLIFT is using ARGB colors to deal with DWM.

If you want to change a specific font or color, then you must use the WinLIFT custom control skSetLabelFont.

See the FF3 Fonts project, attached to the second post of this thread.

...
Title: Re: Winlift and Firefly v3
Post by: Jim Padgett on November 30, 2010, 03:30:54 PM
Rodger Dodger...   Thanks again...