LB Booster
« Incompatibilities with JustBASIC »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 04:36am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Incompatibilities with JustBASIC  (Read 3058 times)
CirothUngol
New Member
Image


member is offline

Avatar

Odie, Odie, cha cha cha.


PM

Gender: Male
Posts: 44
xx Incompatibilities with JustBASIC
« Thread started on: Apr 3rd, 2012, 06:43am »

I know this thread is for reporting incompatibilities with LibertyBASIC 4.x, but I thought you may be interested in some of the differences I've discovered while Boosting my JustBASIC programs:

DIALOG_MODAL windows don't automatically adjust for the extra space taken by the TitleBar when LargeFonts is enabled in WinXP, JB does. Try it on the program from this thread for an example.
--------------------
TextWindows and TextEditor controls in JB don't handle TABs (ie CHR$(9)) at all, they're automatically replaced with 4 SPACEs. LBB handles these correctly.
--------------------
Inkey$ returns different VirtualKey values for SHIFT/CTRL/ALT combinations in JB and LBB. Run this code boosted/non-boosted side-by-side and check out the values (I modified this code from an example in the JB HelpFile). Code:
'Examine the characterInput Function
'NOMAINWIN
    PRINT "Press Any Key(s)..."
    OPEN "Examine Character Input" for GRAPHICS as #graph
    PRINT #graph, "when characterInput [keyPressed]"
    PRINT #graph, "trapclose [quit]"

[loopHere]
    'make sure #graph has input focus
    PRINT #graph, "setfocus"
    TIMER 3000, [SkipLine]
    WAIT

[SkipLine]
    TIMER 0
    #graph "cls"
    GraphTextY = 20
    PRINT "-----"
    WAIT

[keyPressed]
    key$ = Inkey$
    TIMER 0

    SELECT CASE LEN(key$)
        CASE 1
            TempWord$ = key$
        CASE 2
            GOSUB [FindVirtualKeys]
        CASE ELSE
            TempWord$ = "Inkey$ contains " + STR$(len(key$)) + " characters!"
    END SELECT
    PRINT TempWord$
    #graph "place 5 "; GraphTextY; ";|"; TempWord$
    GraphTextY = GraphTextY + 20

    GOTO [loopHere]

[FindVirtualKeys]
    SELECT CASE ASC(RIGHT$(key$, 1))
        CASE _VK_F1
            TempWord$ = "FunctionKey 1 = _VK_F1"
        CASE _VK_F2
            TempWord$ = "FunctionKey 2 = _VK_F2"
        CASE _VK_F3
            TempWord$ = "FunctionKey 3 = _VK_F3"
        CASE _VK_F4
            TempWord$ = "FunctionKey 4 = _VK_F4"
        CASE _VK_F5
            TempWord$ = "FunctionKey 5 = _VK_F5"
        CASE _VK_F6
            TempWord$ = "FunctionKey 6 = _VK_F6"
        CASE _VK_F7
            TempWord$ = "FunctionKey 7 = _VK_F7"
        CASE _VK_F8
            TempWord$ = "FunctionKey 8 = _VK_F8"
        CASE _VK_F9
            TempWord$ = "FunctionKey 9 = _VK_F9"
        CASE _VK_F10
            TempWord$ = "FunctionKey 10 = _VK_F10"
        CASE _VK_F11
            TempWord$ = "FunctionKey 11 = _VK_F11"
        CASE _VK_F12
            TempWord$ = "FunctionKey 12 = _VK_F12"
        CASE _VK_F13
            TempWord$ = "FunctionKey 13 = _VK_F13"
        CASE _VK_F14
            TempWord$ = "FunctionKey 14 = _VK_F14"
        CASE _VK_F15
            TempWord$ = "FunctionKey 15 = _VK_F15"
        CASE _VK_F16
            TempWord$ = "FunctionKey 16 = _VK_F16"
        CASE _VK_MENU
            TempWord$ = "ALT = _VK_MENU"
        CASE _VK_SHIFT
            TempWord$ = "SHIFT = _VK_SHIFT"
        CASE _VK_HOME
            TempWord$ = "HOME = _VK_HOME"
        CASE _VK_END
            TempWord$ = "END = _VK_END"
        CASE _VK_INSERT
            TempWord$ = "INSERT = _VK_INSERT"
        CASE _VK_DELETE
            TempWord$ = "DELETE = _VK_DELETE"
        CASE _VK_NUMLOCK
            TempWord$ = "NUMLOCK = _VK_NUMLOCK"
        CASE _VK_UP
            TempWord$ = "Arrow UP = _VK_UP"
        CASE _VK_DOWN
            TempWord$ = "Arrow DOWN = _VK_DOWN"
        CASE _VK_LEFT
            TempWord$ = "Arrow LEFT = _VK_LEFT"
        CASE _VK_RIGHT
            TempWord$ = "Arrow RIGHT = _VK_RIGHT"
        CASE _VK_NUMPAD0
            TempWord$ = "NumPad 0 = _VK_NUMPAD0"
        CASE _VK_NUMPAD1
            TempWord$ = "NumPad 1 = _VK_NUMPAD1"
        CASE _VK_NUMPAD2
            TempWord$ = "NumPad 2 = _VK_NUMPAD2"
        CASE _VK_NUMPAD3
            TempWord$ = "NumPad 3 = _VK_NUMPAD3"
        CASE _VK_NUMPAD4
            TempWord$ = "NumPad 4 = _VK_NUMPAD4"
        CASE _VK_NUMPAD5
            TempWord$ = "NumPad 5 = _VK_NUMPAD5"
        CASE _VK_NUMPAD6
            TempWord$ = "NumPad 6 = _VK_NUMPAD6"
        CASE _VK_NUMPAD7
            TempWord$ = "NumPad 7 = _VK_NUMPAD7"
        CASE _VK_NUMPAD8
            TempWord$ = "NumPad 8 = _VK_NUMPAD8"
        CASE _VK_NUMPAD9
            TempWord$ = "NumPad 9 = _VK_NUMPAD9"
        CASE ELSE
            TempWord$ = UPPER$(RIGHT$(key$, 1)) + " = CHR$(" + STR$(ASC(RIGHT$(key$, 1))) + ")"
    END SELECT

    IF ASC(key$) AND 16 THEN TempWord$ = "ALT + " + TempWord$
    IF ASC(key$) AND 8 THEN TempWord$ = "CTRL + " + TempWord$
    IF ASC(key$) AND 4 THEN TempWord$ = "SHIFT + " + TempWord$
    IF ASC(key$) AND 2 THEN TempWord$ = "Unknown2 + " + TempWord$
    IF ASC(key$) AND 1 THEN TempWord$ = "Unknown1 + " + TempWord$
    IF ASC(key$) = 0 THEN TempWord$ = "NULL + " + TempWord$

 RETURN

[quit]

    PRINT "Quitting"
    CLOSE #graph
    END 
I have a program that reacts differently depending on whether 1, 2 or 3 of these buttons are pressed, irregardless of which ones they are. It can detect when 1 or 2 of them are pressed, but not all 3.
--------------------
REFRESH is an undocumented feature of JB that allows you to reset the size and position of many different widgets (TextBox, CheckBox, ComboBox, etc.) within a Window by changing the values of the PositionVariables used when originally creating the widgets and then sending a "refresh" command to the window. Check out this code from the JustBASIC Wiki. Code:
    'resize.bas
    'Rewritten for Just BASIC, by Brent D. Thorn, 4/2005
    'This is an example of a program which resizes several
    'controls in a window depending on how the user changes
    'the size of the window.

    nomainwin
    WindowWidth = 550
    WindowHeight = 410

    resizer.lbox1.Width = 256: resizer.lbox1.Height = 186
    listbox #resizer.lbox1, array$(), [lbox1DClick], 0, 0, resizer.lbox1.Width, resizer.lbox1.Height
    resizer.lbox2.Left = 257: resizer.lbox2.Width = 284: resizer.lbox2.Height = 164
    listbox #resizer.lbox2, array$(), [lbox2DClick], resizer.lbox2.Left, 0, resizer.lbox2.Width, resizer.lbox2.Height
    resizer.cbox3.Left = 257: resizer.cbox3.Top = 164: resizer.cbox3.Width = 283
    combobox #resizer.cbox3, array$(), [cbox3DoubleClick], resizer.cbox3.Left, resizer.cbox3.Top, resizer.cbox3.Width, 150
    resizer.tedit4.Top = 186: resizer.tedit4.Width = 540: resizer.tedit4.Height = 195
    texteditor #resizer.tedit4, 1, resizer.tedit4.Top, resizer.tedit4.Width, resizer.tedit4.Height
    open "Resizing example" for window as #resizer
    print #resizer, "trapclose [quit]"
    print #resizer, "resizehandler [resized]"

[loop]
    wait
    goto [loop]

[resized]
    wWid = WindowWidth
    wHig = WindowHeight
    upperVert = int(256/550*wWid) 'upper middle vertical edge
    midHoriz = int(186/410*wHig) 'middle horizontal edge
    urWid = upperVert - wWid
    resizer.lbox1.Width = upperVert
    resizer.lbox1.Height = int(186/410*wHig)
    resizer.lbox2.Left = upperVert
    resizer.lbox2.Width = wWid-upperVert
    resizer.lbox2.Height = int(186/410*wHig)-23
    resizer.cbox3.Left = upperVert
    resizer.cbox3.Top = midHoriz-23
    resizer.cbox3.Width = wWid - upperVert
    resizer.tedit4.Top = midHoriz
    resizer.tedit4.Width = wWid
    resizer.tedit4.Height = wHig-midHoriz
    print #resizer, "refresh"
    goto [loop]

[quit] 'quit the program

    close #resizer
    end 
This no longer works... but then again, I suppose that's why it's openly referred to as Undocumented.

I'm unsure if any of these issues apply to LibertyBASIC as well as JustBASIC, but given the tight similarity between them one might assume that they do. If any of this interests or helps you in any way then I'll try to continue posting these little issues when I come across them... otherwise, you can just tell me to shut up. ^_^
User IP Logged

LB Booster + LB Workshop + LB Builder = My Programs on Google Drive
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Incompatibilities with JustBASIC
« Reply #1 on: Apr 3rd, 2012, 08:29am »

on Apr 3rd, 2012, 06:43am, CirothUngol wrote:
REFRESH is an undocumented feature of JB that allows you to reset the size and position of many different widgets (TextBox, CheckBox, ComboBox, etc.) within a Window by changing the values of the PositionVariables used when originally creating the widgets

It would not be practical for LBB to emulate this peculiarity. The size and position values passed to the various widgets are treated as numeric parameters - the variables (or expressions etc.) used are not stored. In general you cannot expect LBB to implement undocumented features of LB (and neither can you assume LB5 will implement them!).

The original Liberty BASIC 'RESIZE.bas', which uses the documented LOCATE command, works fine in LBB. Why doesn't that work in JB? Does JB not have the LOCATE command? Here is that program, copied directly from the LB examples:

Code:
    'resize.bas
    'This is an example of a program which resizes several
    'controls in a window depending on how the user changes
    'the size of the window.

    nomainwin
    WindowWidth = 550
    WindowHeight = 410

    listbox #resizer.lbox1, array$(), [lbox1DClick], 1, 0, 256, 186
    listbox #resizer.lbox2, array$(), [lbox2DClick], 257, 0, 284, 164
    combobox #resizer.cbox3, array$(), [cbox3DoubleClick], 257, 164, 283, 150
    texteditor #resizer.tedit4, 1, 186, 540, 195
    open "Resizing example" for window as #resizer
    print #resizer, "trapclose [quit]"

[loop]
    print #resizer, "resizehandler [resized]"
    input r$
    goto [loop]

[resized]
    wWid = WindowWidth
    wHig = WindowHeight
    upperVert = int(256/550*wWid) 'upper middle vertical edge
    midHoriz = int(186/410*wHig) 'middle horizontal edge
    urWid = upperVert - wWid
    print #resizer.lbox1, "locate 0 0 "; upperVert; " "; int(186/410*wHig)
    print #resizer.lbox2, "locate "; upperVert; " 0 "; wWid-upperVert; " "; int(186/410*wHig)-23
    print #resizer.cbox3, "locate "; upperVert; " "; midHoriz-23; " "; wWid - upperVert; " "; 100
    print #resizer.tedit4, "!locate 0 "; midHoriz; " "; wWid; " "; wHig-midHoriz;
    print #resizer, "refresh"
   goto [loop]

[quit] 'quit the program

    close #resizer
    end 


Richard.
User IP Logged

CirothUngol
New Member
Image


member is offline

Avatar

Odie, Odie, cha cha cha.


PM

Gender: Male
Posts: 44
xx Re: Incompatibilities with JustBASIC
« Reply #2 on: Apr 3rd, 2012, 12:07pm »

No worries, I certainly don't expect Undocumented features to be supported by any software... I was just pointing out the difference.

As for the LOCATE command, I've still never used LB (but I am about to purchase it) so I'd never heard of it. The code runs when placed in JB, but errors with a "Bad Command" when the window is resized. Maybe JB is based on an earlier version of LB before the command was implemented?

Thanx for the info.
User IP Logged

LB Booster + LB Workshop + LB Builder = My Programs on Google Drive
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