PDA

View Full Version : Why does the dialog caption disappear?



Michael Hartlef
09-09-2008, 09:47
Hi folks,

I wonder why when you switch back and forth from one to the other dialog, the caption of the second dialog is not visible, when it is active:


' Basic Template for custom dialog
' Start Date 09-09-2008
' Created by by

USES "UI"

DIM hDlg, hDlg2 AS DWORD
DIM Msg, wParam, lParam AS DWORD
DIM Ctrl, CtrlMsg AS DWORD

' -- ID numbers of controls

BEGIN CONST
%btnClose = 1000
%btnClose2
END CONST

DIALOG NEW 0, "<Enter title here>", 5, 100, 160, 120, _
%WS_POPUP OR %WS_VISIBLE OR _
%WS_CLIPCHILDREN OR %WS_CAPTION OR _
%WS_SYSMENU OR %WS_MINIMIZEBOX, 0 TO hDlg
DIALOG NEW 0, "<Enter title here2>", 200, 100, 160, 120, _
%WS_POPUP OR %WS_VISIBLE OR _
%WS_CLIPCHILDREN OR %WS_CAPTION OR _
%WS_SYSMENU OR %WS_MINIMIZEBOX, 0 TO hDlg2

' -- Place controls here

CONTROL ADD BUTTON, hDlg, %btnClose, "Click to close", 95, 100, 60, 14

' -- Place controls here

CONTROL ADD BUTTON, hDlg2, %btnClose2, "Click to close2", 95, 100, 60, 14

DIALOG SHOW MODELESS hDlg2
DIALOG SHOW MODELESS hDlg

WHILE ISWINDOW( hDlg )
' -- Get dialog messages
Msg = GETMESSAGE( hDlg, wParam, lParam )
SELECT CASE Msg
CASE %WM_Command
' -- Here you can process the input from controls
Ctrl = LOWRD( wParam )
CtrlMsg = HIWRD( wParam )
SELECT CASE Ctrl
CASE %btnClose
IF CtrlMsg = 0 THEN EXIT WHILE
CASE %btnClose2
IF CtrlMsg = 0 THEN EXIT WHILE
END SELECT
CASE %WM_SYSCOMMAND
IF wParam = %SC_Close THEN EXIT WHILE
END SELECT

' -- Get dialog2 messages
Msg = GETMESSAGE( hDlg2, wParam, lParam )
SELECT CASE Msg
CASE %WM_Command
' -- Here you can process the input from controls
Ctrl = LOWRD( wParam )
CtrlMsg = HIWRD( wParam )
SELECT CASE Ctrl
CASE %btnClose2
IF CtrlMsg = 0 THEN EXIT WHILE
END SELECT
CASE %WM_SYSCOMMAND
IF wParam = %SC_Close THEN EXIT WHILE
END SELECT
WEND

' -- Closes the dialog

DIALOG END hDlg2
DIALOG END hDlg

Lionheart008
09-09-2008, 09:58
:-) dear michael... a short reply...

I have checked your script with two windows (good!), send a screeny...

a) what does you mean with "caption"? In films I know captions ;-)

b) do you like to get a message by clicking or reacting with your little windows?

bye, see you soon, I do a "break" :-)

ciao und servus, lionheart
c) - don't laugh, perhaps I can help :-D

Petr Schreiber
09-09-2008, 10:13
Hi Mike,

I cannot replicate the behavior.
Does the caption bar disappear as a such or just the text?


Petr

ErosOlmi
09-09-2008, 10:17
Same here,
I cannot replicate the problem. It seems ok here.
Eros

Michael Hartlef
09-09-2008, 10:39
Hi Mike,

I cannot replicate the behavior.
Does the caption bar disappear as a such or just the text?


Petr


Just the text "Enter Title here2" disappears when you set the focus on dialog2 via a mouse click. When you switch back to dialog 1 it is visible again. Weird.

Michael Hartlef
09-09-2008, 10:41
a) what does you mean with "caption"? In films I know captions ;-)


I ment the "title" of the dialog. Usually this is called the caption. At least I think so.

ErosOlmi
09-09-2008, 11:43
I've tested under WinME and WinXP and version 1.6.0.10 plus 1.7.0.0 (the new coming out) but not able to see the problem.

Can you try to avoid "<" and ">" in caption and see if it makes any difference?
thinBasic is not making any consideration on window caption but maybe there are other process that for some reasons check caption text.

Let me know.
Eros

Michael Hartlef
09-09-2008, 12:15
No, it makes no difference. But don't follow it further as when I use callbacks for each dialog, it doesn't happen. So I use that way. I just thought that I made an obvious mistake and I didn't see it.

Lionheart008
09-09-2008, 12:54
hi mike :), hi all...

try this one... I have only changed the title with a name (caption)...
and has modified the second windows in xy-direction...

perhaps this example runs as you wish...

bye, lionheart

ps: perhaps you has only to restart your pc? and the script does handling you wish :-)
I always wondering about my computer, the machine has sometimes his own ideas

ErosOlmi
09-09-2008, 13:28
Michael,

can you please just make a last confirmation: in the past there was problems when handle variables were defined AS DWORD (you too solved the problem about images disappearing).

So change:

DIM hDlg, hDlg2 AS DWORD
DIM Msg, wParam, lParam AS DWORD
DIM Ctrl, CtrlMsg AS DWORD
to

DIM hDlg, hDlg2 AS LONG
DIM Msg, wParam, lParam AS LONG
DIM Ctrl, CtrlMsg AS LONG

and let me know.

Ciao
Eros

Michael Hartlef
09-09-2008, 13:47
Sorry guys, new start of the computer and changing DWORD to LONG had no effect. It's my work computer and there is a lot of stuff running on at the same time. Maybe that is why.

ErosOlmi
09-09-2008, 16:10
Michael,

I've just refreshed new thinBasic preview version 1.7.0.0. See http://community.thinbasic.com/index.php?topic=2027.msg14971#msg14971
Hoping, it should address the problem you described in this post.

Let me know.

Ciao
Eros

Michael Hartlef
09-09-2008, 17:52
Hi Eros, I'm at home now where everything works fine. I'll have to wait till tommorow to see if it works at work too. Thanks anyway for the new preview!

Michael Hartlef
10-09-2008, 07:23
Good morning Eros,

it works good now. Thanks! did you change something?

Michael

ErosOlmi
10-09-2008, 07:30
Ciao Michael, good morning ;)

Yes, there was an error on how notification message %WM_NCACTIVATE (http://msdn.microsoft.com/en-us/library/ms632633(VS.85).aspx) was handled by thinBasic message pump when using WHILE, GetMessage, WEND method.

For new dialog/control callback way of handling events there is no problem because every dialog has separated message pump. For old style WHILE/WEND there is only one internal message pump handling all the windows created with DIALOG NEW. That internal message pump is currently making "mortal jump" to be able to handle all events coming from a single dialog, when there are two, jump is "double mortal jump" ;)

ErosOlmi
10-09-2008, 08:02
Sometimes old OSs come in help.
Win95 and Win98 are very sensible so they crash quite quickly if something is programmed the wrong way while more modern OSs like XP tend to hide programming errors because the process runs into a sort of isolated box. Many errors are handled by the OS that makes its best to solve without crashing the system.

So in this case I just tested your script under Win98 first edition looking that it instead of just removing the caption it was crashing. Perfect symptom of bad programming ;)
So I got the point removing one by one all the notification messages till I found the one creating the problem.

Ciao
Eros

Michael Hartlef
10-09-2008, 09:51
Cool, I'm glad you had squished that bug. :)

Michael Hartlef
10-09-2008, 09:54
....when there are two, jump is "double mortal jump" ;)



Sounds like Mortal Combat to me. ;D Round 2...... FIGHT!!!!