I have a dialog with six command buttons on it where I specify the caption for these buttons during the form create of a firefly project.
When I skin the dialog only the first command button has the text centered on the button, all the other buttons the caption is displayed on the bottom of the button. ( like the button has 3 lines of text and the caption is displayed on the 3rd line ) .
If I don't skin the dialog the button captions are centered in the middle of the command buttons.
Any ideas as to why this is happening ?
Jim
Try skinning your window only after all the controls have been created.
Or try using : skSkinWindowUpdate
When new controls are added AFTER the initial skinning of the main window.
SUB skSkinWindowUpdate ( _
BYVAL hWnd AS LONG, _ ' The main window handle.
BYVAL RedrawFlag AS LONG _ ' Redraw boolean flag.
)
Set the RedrawFlag to TRUE if you want to force an immediate redraw of the popup window.
See also:
skSkinDisable, skSkinEnable
No difference. It is like only the first button sees the BS_VCENTER window style of the button control.
What doesn't make sense for me is why the first button on the form works fine.
Jim,
Looking at the WinLIFT code for the CONSTANT BS_VCENTER = &HC00, i found that i made a change in WinLIFT version 4.83 to deal with the change done in FF3.
'%BS_LEFT = &H100&
'%BS_RIGHT = &H200&
'%BS_CENTER = &H300&
'%BS_TOP = &H400&
'%BS_BOTTOM = &H800&
'%BS_VCENTER = &HC00&
Alignment = zGetButProperty(hWnd, %PROP_ALIGNMENT)
IF CheckStyle(Alignment, %BS_CENTER) THEN
CALL GdipSetStringFormatAlign(nStrFormat, %StringAlignmentCenter)
ELSEIF CheckStyle(Alignment, %BS_RIGHT) THEN
CALL GdipSetStringFormatAlign(nStrFormat, %StringAlignmentFar)
END IF
' // 4.83 changed to match with FF3.
IF CheckStyle(Alignment, %BS_VCENTER) THEN
CALL GdipSetStringFormatLineAlign(nStrFormat, %StringAlignmentCenter)
ELSEIF CheckStyle(Alignment, %BS_BOTTOM) THEN
CALL GdipSetStringFormatLineAlign(nStrFormat, %StringAlignmentFar)
END IF
What could help is a short compiled FF3 code that i could check.
I don't know wich version of FF3 you are using, the one i have myself is version 3.10.
...
I have attached the latest WinLIFT version 4.90 to this post, and a short DDT example to test setting the text after the window has been skinned.
To display the text on button ID = 2 and button ID = 3, click on the PushButton named "one".
#COMPILE EXE "TestBtn.exe"
%WM_USER = &H400
%WM_DRAWITEM = &H2B
%WM_INITDIALOG = &H110
%WM_COMMAND = &H111
%WS_OVERLAPPED = &H0
%WS_POPUP = &H80000000
%WS_CHILD = &H40000000
%WS_VISIBLE = &H10000000
%WS_CAPTION = &H00C00000 ' WS_BORDER OR WS_DLGFRAME
%WS_VSCROLL = &H00200000
%WS_SYSMENU = &H00080000
%WS_THICKFRAME = &H00040000
%WS_TABSTOP = &H00010000
%WS_MINIMIZEBOX = &H00020000
%WS_MAXIMIZEBOX = &H00010000
%WS_OVERLAPPEDWINDOW = %WS_OVERLAPPED OR %WS_CAPTION OR %WS_SYSMENU OR %WS_THICKFRAME OR %WS_MINIMIZEBOX OR %WS_MAXIMIZEBOX
%HWND_TOP = 0
%HWND_BOTTOM = 1
%BS_LEFT = &H100&
%BS_RIGHT = &H200&
%BS_CENTER = &H300&
%BS_TOP = &H400&
%BS_BOTTOM = &H800&
%BS_VCENTER = &HC00&
'--------------------------------------------------------------------
DECLARE CALLBACK FUNCTION DlgProc() AS LONG
#INCLUDE "WINLIFT.INC"
'¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
' Main entrance
'--------------------------------------------------------------------
FUNCTION PBMAIN () AS LONG
LOCAL hDlg AS DWORD, hCtrl AS LONG, sResource AS STRING
DIALOG NEW PIXELS, 0, "Buttons",,, 480, 360, %WS_OVERLAPPEDWINDOW, 0 TO hDlg
CONTROL ADD BUTTON, hDlg, 1, "One", 10, 100, 120, 50
CONTROL ADD BUTTON, hDlg, 2, "", 10, 200, 120, 50, %BS_CENTER OR %BS_VCENTER
CONTROL ADD BUTTON, hDlg, 3, "", 10, 300, 120, 50, %BS_CENTER OR %BS_VCENTER
IF skInitEngine("Sony.sks", "") THEN
CALL skSkinWindow(hDlg, "Dock|Undock|Minimize|Maximize|Restore|Close")
END IF
DIALOG SHOW MODAL hDlg CALL DlgProc
END FUNCTION
'¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
' Main callback
'--------------------------------------------------------------------
CALLBACK FUNCTION DlgProc() AS LONG
SELECT CASE CBMSG
CASE %WM_COMMAND
SELECT CASE CBCTL
CASE %IDCANCEL
IF CBCTLMSG = %BN_CLICKED OR CBCTLMSG = 1 THEN 'end prog
DIALOG END CBHNDL
END IF
CASE 1
CONTROL SET TEXT CBHNDL, 2, "Two"
CONTROL SET TEXT CBHNDL, 3, "Three"
END SELECT
END SELECT
END FUNCTION
I can't see any problem there.
I created a new project with 5 text boxes and the new project works as expected..
Must be something with my first app...
Thanks Patrice ... you can drop this one.