BBC BASIC for Windows
Programming >> User Interface >> Create a Tooltip for a Control
http://bb4w.conforums.com/index.cgi?board=ui&action=display&num=1401394586

Create a Tooltip for a Control
Post by g3nrw on May 29th, 2014, 8:16pm

Richard

At the risk of being told to RTFM (again), is there any way in BB4W to create tooltips for *controls* (as distinct from toolbars)?

--
Ian

Re: Create a Tooltip for a Control
Post by rtr on May 29th, 2014, 8:51pm

on May 29th, 2014, 8:16pm, g3nrw wrote:
is there any way in BB4W to create tooltips for *controls*

http://bb4w.wikispaces.com/Adding+tooltips+to+a+dialogue+box

Richard.
Re: Create a Tooltip for a Control
Post by g3nrw on May 30th, 2014, 07:52am

Just the job. Thanks yet again Richard.

--
Ian

Re: Create a Tooltip for a Control
Post by g3nrw on May 31st, 2014, 12:57pm

Richard

Following your recent help and guidance, I have now almost completed (what I will call here) Program #1. Basically it is a dialog box containing about 30 controls. Program #1 does not contain any tooltips code. It works exactly as expected, without any hiccups.

I have now created Program #2. This is exactly the same as Program #1, but with tooltips added for most of the controls. The tooltips code very closely follows the example at:

http://bb4w.wikispaces.com/Adding+tooltips+to+a+dialogue+box

Again, this program works exactly as expected, except for one thing. Typically, I edit some code, run the program, then stop it (Run>Stop in the editor window), then edit some more code. Then, after a few minutes of editing (~4-5 minutes), BB4W crashes completely without warning, and I have to restart it.

This is quite reproducible: edit, run once, edit, crash. If I don't run the program, BB4W doesn't crash.

I'm sure the fault is mine -- I have spent several hours scouring the code for a mistake -- but before I dig any deeper, I wonder if you have seen anything like this before.

For the record, I am running BB4W v5.94a, under Windows 7 32-bit, if that's relevant.

--
Ian


Re: Create a Tooltip for a Control
Post by rtr on May 31st, 2014, 1:30pm

on May 31st, 2014, 12:57pm, g3nrw wrote:
I wonder if you have seen anything like this before.

Yes, it's common. The most likely cause is that you have forgotten to close the dialogue box (PROC_closedialog) before you exit your program. It's essential that your program has both ON ERROR and ON CLOSE statements to ensure that happens; typically they will call a routine which takes care of all such 'cleanup' operations:

Code:
      ON CLOSE PROCcleanup : QUIT
      ON ERROR SYS "MessageBox", @hwnd%, REPORT$, 0, 0 : PROCcleanup : QUIT
      ...
      PROCcleanup
      QUIT

      DEF PROCcleanup
      dlg% += 0 : IF dlg% PROC_closedialog(dlg%)
      ENDPROC 

Also remember not to use the 'emergency stop' feature (e.g. the Stop button in the toolbar) which bypasses the cleanup and therefore is likely to trigger the crash.

Incidentally, being aware of this characteristic of the BB4W IDE, I designed the LB Booster IDE to work differently - when you execute a program in LBB it runs as a separate process, making it immune to crashes of this sort.

Richard.

Re: Create a Tooltip for a Control
Post by g3nrw on Jun 2nd, 2014, 10:41am

on May 31st, 2014, 1:30pm, Richard Russell wrote:
Also remember not to use the 'emergency stop' feature (e.g. the Stop button in the toolbar) which bypasses the cleanup and therefore is likely to trigger the crash.

Richard.


Yes, I had already incorporated the cleanup code you mentioned, but recently I have got into the (bad) habit of terminating the program with an emergency stop. Previously this had not been an issue, but after I added the tooltips code, it seems to have become one. I am now terminating the program "properly", and the crashes have gone.

--
Ian