BBC BASIC for Windows
« Closing Dialog Boxes »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 11:47pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Closing Dialog Boxes  (Read 1337 times)
Matt
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 210
xx Closing Dialog Boxes
« Thread started on: Sep 28th, 2014, 08:54am »

Hi,

According to most help facilities, the normal way to close a dialog box routine is something like:

Code:
      ...
      UNTIL click% = 2 OR !dlg% = 0
      IF !dlg% <> 0 THEN PROC_closedialog(dlg%) 

When either the exit cross (top-right corner) or the 'Close' button is clicked upon, click% receives a close notification (2). (Although, you can catch the 'Close' before exiting the dialog box.) Either way, !dlg% retains the original pointer.

What is the reason for adding the '... OR !dlg% = 0' and the following 'IF !dlg% <> 0 THEN...'. Missing these out seems to have the same effect, so I'm guessing there's a good reason for them being advised.

Matt
User IP Logged

rtr2
Guest
xx Re: Closing Dialog Boxes
« Reply #1 on: Sep 28th, 2014, 09:30am »

on Sep 28th, 2014, 08:54am, Matt wrote:
Either way, !dlg% retains the original pointer.

My tests suggest otherwise. Please perform these steps exactly:
  1. Load the supplied DLGDEMO.BBC program (in the EXAMPLES\WINDOWS folder).

  2. Add the following statement immediately after the UNTIL click%=1 OR click%=2 OR !dlg%=0 line:
    Code:
          PRINT !dlg% 

  3. Run the program (ignore the warning) and close the dialogue box by clicking on the corner X, or by pressing Escape.
When I do this what gets printed is zero, which contradicts your assertion that !dlg% retains the original handle.

I am puzzled if you are seeing something different, unless of course you're using a different library, such as WINLIB2B which is specifically documented as behaving differently in this respect: "WINLIB2B also suppresses the automatic closing of the dialogue box when you click on its close button, or press Escape":

http://www.bbcbasic.co.uk/bbcwin/manual/bbcwing.html#winlib2

Richard.
« Last Edit: Sep 28th, 2014, 09:31am by rtr2 » User IP Logged

Matt
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 210
xx Re: Closing Dialog Boxes
« Reply #2 on: Sep 28th, 2014, 3:34pm »

on Sep 28th, 2014, 09:30am, g4bau wrote:
I am puzzled if you are seeing something different, unless of course you're using a different library, such as WINLIB2B which is specifically documented as behaving differently in this respect: "WINLIB2B also suppresses the automatic closing of the dialogue box when you click on its close button, or press Escape":

I'm actually using WINLIB2A. I can't remember why I started using it over WINLIB2, but I've been using it for ages. What are the differences, advantages and disadvantages of this one and others, which also have variants (which whould you suggest I normally use.)

Matt
User IP Logged

rtr2
Guest
xx Re: Closing Dialog Boxes
« Reply #3 on: Sep 28th, 2014, 5:29pm »

on Sep 28th, 2014, 3:34pm, Matt wrote:
I'm actually using WINLIB2A. I can't remember why I started using it over WINLIB2, but I've been using it for ages. What are the differences, advantages and disadvantages of this one and others

The only documented versions are WINLIB2.BBC, WINLIB2B.BBC and WINLIB2U.BBC; the differences are described in the manual. As far as WINLIB2A is concerned I cannot remember how that differs; my inclination would be to suggest that it isn't used.

Richard.
« Last Edit: Sep 28th, 2014, 5:30pm by rtr2 » User IP Logged

Matt
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 210
xx Re: Closing Dialog Boxes
« Reply #4 on: Sep 28th, 2014, 8:07pm »

OK. Fair enough.

Matt
User IP Logged

Matt
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 210
xx Re: Closing Dialog Boxes
« Reply #5 on: Sep 29th, 2014, 07:12am »

I recently reinstalled my desktop, including BB4W. I installed version 5.8 full and upgraded to 5.95. I've just checked and WINLIB2A is there. I've been using it for some time, so I assume, then, that it was shipped with 5.8.

This is not an important matter, as your suggestion that I should probably use WINLIB2 instead, will be used. But as you seemed to be unaware of the differences, I thought you might be interested.

Matt
User IP Logged

rtr2
Guest
xx Re: Closing Dialog Boxes
« Reply #6 on: Sep 29th, 2014, 08:48am »

on Sep 29th, 2014, 07:12am, Matt wrote:
I've just checked and WINLIB2A is there.

Of course I am aware that WINLIB2A was distributed with BB4W, and it continues to be. Generally I never delete things from the distribution, even if they become obsolete (assuming they still work). But it's undocumented and I can't remember what the differences are (I have a suspicion that maybe it was designing to support context-sensitive help before *SYS 1 was introduced).

Richard.
User IP Logged

rtr2
Guest
xx Re: Closing Dialog Boxes
« Reply #7 on: Sep 29th, 2014, 11:32am »

on Sep 29th, 2014, 08:48am, g4bau wrote:
I have a suspicion that maybe it was designed to support context-sensitive help before *SYS 1 was introduced

I can confirm that. Before the introduction of *SYS 1 there was no way to intercept and respond to WM_HELP messages received from a dialogue box. Accordingly, WINLIB2A converts them into WM_COMMAND messages with a special ID value (999), which can be handled by a regular ON SYS.

*SYS 1 makes that kludge obsolete, because WM_HELP messages can now be intercepted directly. Therefore on the introduction of that command WINLIB2A was replaced by WINLIB2B (which forwards WM_HELP messages to the parent window). However on the basis that some programs might still be using WINLIB2A it remained in the BB4W distribution.

WINLIB2A is now undocumented and ought not to be used in new programs. Existing programs which use it can continue to do so, at your own risk, so long as they work as required.

Richard.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls