Suggestion_AboutSecondWindoow

Started by mr_unreliable, October 21, 2023, 05:03:25 PM

Previous topic - Next topic

MrBcx

Quote from: mr_unreliable on October 21, 2023, 05:03:25 PM

But anyway, I think it might be worthwhile to modify the "Two Forms Demo" example to reflect the advice found on the "BEGIN EVENTS" page.


I disagree.  The two examples are teaching completely different lessons.  The
first is a lesson on subclassing and trapping messages while the second is a
straightforward lesson on how to create multiple forms, each with their own
Windows procedure. 

It's also important to point out that the second example relies on the BCX_WND
function which takes the name of its windows procedure (event loop) as one of
its arguments.  Also, one uses SUB FORMLOAD and the other WINMAIN. 
It's an elegant, easy to grasp method for using multiple forms. 


mr_unreliable

Hello Group,

I was wanting to show a second window, and found a handy example for this called the "Two Forms Demo" on the "FUNDCTION and SUB" help file page.

I tried the example code, and it worked perfectly well "as-is".  However, when I tried it in my program, it caused the controls on the main form to become scrambled.  That made me think that there was some sort of confusion between the wndprocs for the two forms/windows.

I then noticed an example on the "BEGIN EVENTS" page, which suggested a notation on the "BEGIN EVENTS" and "END EVENTS" statements which would tie the event loops more closely to their form/window.  That is, adding a form identifier to begin, and adding MAIN to end events (in the main window), and similar treatment for the event loop associated with the second form/window.

That worked for me.  Full Disclosure: I also removed some re-sizing code, so more testing should have been done to determine which change caused the problem to go away.

But anyway, I think it might be worthwhile to modify the "Two Forms Demo" example to reflect the advice found on the "BEGIN EVENTS" page.

cheers, mru

developed on winXP, using BCX v7.45, and PellesC v6.0 
   (sorry, if this was already addressed in some later version)