PDA

View Full Version : add label bug or my mistake



sandyrepope
08-09-2007, 20:56
I'm not sure if there is a bug or I'm just making a mistake. When I run this script nothing shows up in the label.


uses "UI"

%ID_CURRENT_WORD = 10

DIM hDlg AS DWORD, hImg AS DWORD, x AS DWORD, Y AS DWORD

dim Msg, wparam,lparam as dword

DIALOG NEW 0, "thinBASIC", -1, -1, 280, 240, _
%WS_DLGFRAME OR _
%DS_CENTER OR _
%WS_CAPTION OR _
%WS_SYSMENU OR _
%WS_OVERLAPPEDWINDOW, _
0 TO hDlg

control add label, hDlg, %ID_CURRENT_WORD, "Some text to display", 7, 150, 255, 25, %SS_ETCHEDFRAME


DIALOG SHOW modeless hDlg


while isWindow(hDlg)
Msg = GetMessage(hDlg, wParam, lParam)

select case Msg
CASE %WM_SYSCOMMAND

SELECT CASE wParam

CASE %SC_CLOSE
EXIT WHILE

END SELECT
END SELECT

wend
DIALOG END hDlg


I might be making a mistake but if I am I can't find it.

Thanks
Sandy

Michael Clease
08-09-2007, 22:37
looks like its something to do with the etchedframe


control add label, hDlg, %ID_CURRENT_WORD, "", 7, 150, 255, 25, %SS_ETCHEDFRAME
control add label, hDlg, %ID_CURRENT_WORD+1, "Some text to display", 10, 160, 250, 10 ', %SS_ETCHEDFRAME

try the above lines.

ErosOlmi
08-09-2007, 23:07
Yes, Abraxas is right.

Seems %SS_ETCHEDFRAME as style alone in reality is like CONTROL ADD FRAME ...
I've found some other forum spotting the same problem. Example in PowerBasic forum: http://www.powerbasic.com/support/pbforums/showthread.php?t=21815

A possible solution seems to change in the following way:



uses "UI"

%ID_CURRENT_WORD = 10

DIM hDlg AS DWORD, hImg AS DWORD, x AS DWORD, Y AS DWORD

dim Msg, wparam,lparam as dword

DIALOG NEW 0, "thinBASIC", -1, -1, 280, 240, _
%WS_DLGFRAME OR _
%DS_CENTER OR _
%WS_CAPTION OR _
%WS_SYSMENU OR _
%WS_OVERLAPPEDWINDOW, _
0 TO hDlg

CONTROL ADD LABEL, hDlg, %ID_CURRENT_WORD, "Some text to display", 7, 150, 255, 25, _
%WS_CHILD OR %WS_VISIBLE OR %SS_LEFT, _
%WS_EX_STATICEDGE OR %WS_EX_LEFT OR %WS_EX_LTRREADING
'---Add a frame over the label
CONTROL ADD LINE , hDlg, -1, "Line1", 7, 150, 255, 25

CONTROL SET COLOR hDlg, %ID_CURRENT_WORD, %black, -2


DIALOG SHOW modeless hDlg


while isWindow(hDlg)
Msg = GetMessage(hDlg, wParam, lParam)

select case Msg
CASE %WM_SYSCOMMAND

SELECT CASE wParam

CASE %SC_CLOSE
EXIT WHILE

END SELECT
END SELECT

wend

DIALOG END hDlg


Hope this help
Eros