BBC BASIC for Windows
« LBB Conversion »

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



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: LBB Conversion  (Read 557 times)
RNBW
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 19
xx LBB Conversion
« Thread started on: May 2nd, 2015, 4:51pm »

Richard

You provided a very useful bit of code in LBB Conforums (below:)

Code:
    number.of.rows = 8

    for row = 1 to number.of.rows
      for col = 0 to 4
        textbox #w.tb, 10+col*55, row*20, 55, 20
        maphandle #w.tb, "#w.tb";row;col
      next col
    next row
    open "Textbox grid" for window as #w
    #w.tb42 "Some text"
    wait
 


I used LBB to convert it to BBC Basic and it provided the code below:

Code:
      REM Automatically translated from Liberty BASIC to BBC BASIC
      REM by 'LB Booster' version 3.00, Sat. 02 May 2015, 17:21:20
      REM!Crunch spaces,rems
      REM!Embed @lib$+"LBLIB.BBCC", @lib$+"LBprompt.tpl"
      HIMEM=PAGE+&1F400000:INSTALL @lib$+"LBLIB.BBCC":PROC_LBinit
      Version$ = "4.04 (LBB 3.00)":Err$ = "":erl%=0:lc%=0:io&=&F

      number`of`rows = 8

      FOR row = 1 TO number`of`rows : WHILE 1 > (number`of`rows) EXIT FOR : ENDWHILE
        FOR col = 0 TO 4
          PROC_textbox(`w, `w`tb, "#w.tb", 10 + col * 55, row * 20, 55, 20)
          PROC_maphandle$(`w`tb, "#w.tb" + STR$(row) + STR$(col))
        NEXT col
      NEXT row
      PROC_open("Textbox grid", "window", "#w", `w)
      PROC_gui(`w`tb42, "Some text")
      PROC_wait
      PROC_end
 


This works a treat except that if I run the code and then close the output and try to run it again, it comes up with the error message <<Couldn't register class>>. Closing down BBC Basic and reload and it works again, and so on. It doesn't work if you just close down the code. Still the error message. Any idea why this happens?

Also, I notice the use of the character ( ` ) is used in the conversion. What is the significance of this.



User IP Logged

rtr2
Guest
xx Re: LBB Conversion
« Reply #1 on: May 2nd, 2015, 5:56pm »

on May 2nd, 2015, 4:51pm, RNBW wrote:
Any idea why this happens?

Yes, it's because the LBB IDE runs your program in a different process whereas the BB4W IDE runs your program in the same process. So, when run from LBB, Windows conveniently does a whole load of cleanup operations when the program - and therefore process - terminates (including automatically unregistering the class). This doesn't happen in BB4W because the process isn't terminated (unless you close BB4W down and open it again).

In principle you could probably eliminate the error by unregistering the class yourself (the class name is "LB2BBC" which is an interesting hangover from its early origins!) but you could still have problems if your program terminates 'abnormally'.

There are a number of features of the LBLIB library which makes it unsuitable for running from the BB4W IDE, of which this is one. That's why I never recommend attempting to port a program from LBB to BB4W without rewriting it sufficiently to allow LBLIB to be dispensed with (e.g. by using BB4W libraries instead).

Quote:
Also, I notice the use of the character ( ` ) is used in the conversion. What is the significance of this.

No particular 'significance' other than it's a character which is legal in a variable name, but which is little used. Therefore it's a handy replacement for characters which are valid in Liberty BASIC but not BBC BASIC (for example a dot).

Richard.
User IP Logged

RNBW
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 19
xx Re: LBB Conversion
« Reply #2 on: May 2nd, 2015, 7:01pm »

Thanks for the explanation. In due course, I want to reproduce the program I am writing in LBB in BB4W and wanted to see if the LBB conversion helped and I found the problem when I ran it. I think I shall probably need your help when I finally get round to it.

Ray
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