Menu
JAQForum Ver 19.10.27

Forum Index : Microcontroller and PC projects : MMBasic for Windows - betas

   Page 14 of 30    
Posted: 02:17am
09 Apr 2022
Copy link to clipboard
panky
Guru


Problem with GUI CLICK(REF)

Version 5.07.03b8



GUI Area #1,0,0,200,200
GUI Interrupt Mouseclick
Do
Loop

Sub Mouseclick
 Print CLICK(REF)
End Sub


When run, gives the following error after a mouse click in the area defined in the program.

Error in line 8: CLICK is not declared

Testing with Ctrlval shows the mouse click is recognised and correctly returns the #ref from the GUI AREA command.

Edit: Unsure about this last bit. Changing CLICK (CMM2) to TOUCH (picomite) makes no difference. What I am trying to achieve is for the GUI AREA command to return the control value assigned. D.
Edited 2022-04-09 13:14 by panky
 
Posted: 06:58am
09 Apr 2022
Copy link to clipboard
matherp
Guru

Try MOUSE(REF)
 
Posted: 02:07pm
09 Apr 2022
Copy link to clipboard
thwill
Guru


Spurious trailing NULL in written file:

> list "bad_file.bas"
Option Base 0
Option Default None
Option Explicit On
Option Console Both

Dim f$ = "myfile.txt"

Open f$ For Output As #1
Print #1, "Hello World"
Close #1

Open f$ For Append As #1
Print #1, "Goodbye World"
Dim i% = Eof(#1) ' It doesn't happen if this line is omitted.
Close #1

Open f$ For Input As #1
Dim s$ = Input$(255, 1)
Close #1

Dim ch%
For i% = 1 To Len(s$)
 ch% = Asc(Mid$(s$, i%, 1))
 If ch% > 31 And ch% < 255 Then
   Print Chr$(ch%);
 Else
   Print "<" Hex$(ch%, 2) ">";
 EndIf
Next
Print

Print "Where did the trailing <00> come from?"
> run
Hello World<0D><0A>Goodbye World<0D><0A><00>
Where did the trailing <00> come from?
>


Best wishes,

Tom
 
Posted: 11:14am
10 Apr 2022
Copy link to clipboard
matherp
Guru

V5.07.03b9


MMBasic.zip

Fixes the two bugs Tom has reported.

In addition (because it was so easy) saves and restores the ON ERROR SKIP status if an interrupt happens before the offending line
 
Posted: 09:22pm
10 Apr 2022
Copy link to clipboard
thwill
Guru


  matherp said  V5.07.03b9

Fixes the two bugs Tom has reported.

In addition (because it was so easy) saves and restores the ON ERROR SKIP status if an interrupt happens before the offending line


Thanks Peter, tested the first two and confirm they are fixed. Not tested the latter at this time.

A regression that I think has occurred at some point in the last couple of builds:
? Day$(Now)
dummy


Best wishes,

Tom
 
Posted: 09:29pm
10 Apr 2022
Copy link to clipboard
matherp
Guru

Think it is a day 1 bug. Just happens to be only on Sundays.


MMBasic.zip
 
Posted: 09:36pm
10 Apr 2022
Copy link to clipboard
thwill
Guru


An interesting one on the CMM2 - so probably the wrong thread, yet here I am :

> ON ERROR SKIP
> OPEN "file-that-exists" FOR INPUT AS #1
> ? "*" MM.ERRMSG$ "*"
*Succeeded *


1. That there is any MM.ERRMSG$ on success is a bit counter-intuitive, and means you need to be careful to check MM.ERRNO <> 0, not MM.ERRMSG$ <> "" if you are interested in handling errors.

2. The "Succeeded " message has a trailing space; irrelevant if (1) were fixed.

Note that MMB4W does not set MM.ERRMSG$ on success, it would (correctly) be the empty string in this example.

Also on CMM2 and MMB4W:
SEEK #fnbr, pos

does not report an error if pos <= 0, it probably should.

Best wishes,

Tom
 
Posted: 01:45pm
11 Apr 2022
Copy link to clipboard
thwill
Guru


Here is an inconsistency between MMB4W and the CMM2.

MMB4W:
> list "append_loc_bug.bas"
Option Base 0
Option Default None
Option Explicit 1
Option Console Both

Dim f$ = "append_loc_bug.txt"

Open f$ For Output As #1
Print #1, "foo";
Close #1

Open f$ For Append As #1
Print Loc(#1)
Close #1

End
> run "append_loc_bug.bas"
1
>


Run the same code on the CMM2 and it outputs 4 ... I think that the CMM2 is probably correct and MMB4W incorrect.

Best wishes,

Tom
 
Posted: 02:06pm
11 Apr 2022
Copy link to clipboard
matherp
Guru

Looks like a bug/feature in ftell/fopen. As soon as you write something it will return the correct value but it doesn't seem to set the filepointer until something is written. Don't think I can do anything about it?
 
Posted: 08:59am
12 Apr 2022
Copy link to clipboard
thwill
Guru


  matherp said  Looks like a bug/feature in ftell/fopen. As soon as you write something it will return the correct value but it doesn't seem to set the filepointer until something is written. Don't think I can do anything about it?


It looks like the C specification does not specify the behaviour in this particular case and thus an implementation is free to do what it wants - Linux/GCC behaves like the CMM2. Of course if you wanted you could get MMBasic to handle it as a special case when it knows a file has been opened for APPEND - YMMV.

Best wishes,

Tom
Edited 2022-04-12 19:08 by thwill
 
Posted: 10:21am
12 Apr 2022
Copy link to clipboard
Kabron
Regular Member


With any version of MMBasic I got blank window which dissapeared in about 15 seconds.
Windows 10 x64

 
Posted: 01:51pm
15 Apr 2022
Copy link to clipboard
Kabron
Regular Member


  Kabron said  With any version of MMBasic I got blank window which dissapeared in about 15 seconds.
Windows 10 x64

Observed on two PC

Last working version: 5.07.03pa12
Edited 2022-04-15 23:53 by Kabron
 
Posted: 02:26pm
15 Apr 2022
Copy link to clipboard
mclout999
Guru


  Kabron said  
  Kabron said  With any version of MMBasic I got blank window which dissapeared in about 15 seconds.
Windows 10 x64

Observed on two PC

Last working version: 5.07.03pa12


Is this just the first time you run it or every time?  My antivirus(Avast) software interrupts the first run but pops up a notice that it is scanning the entire run of the code. Then It continues.  Maybe your antivirus is doing the same thing but not notifying you about the run time scan like mine does.
 
Posted: 04:27pm
15 Apr 2022
Copy link to clipboard
matherp
Guru

  Quote  With any version of MMBasic I got blank window which dissapeared in about 15 seconds.
Windows 10 x64


See page 8 of this thread and try launching from a DOS box with

MMBASIC 0
 
Posted: 07:07am
16 Apr 2022
Copy link to clipboard
Kabron
Regular Member


  matherp said  

See page 8 of this thread and try launching from a DOS box with

MMBASIC 0


This works,
but COPY/PASTE not work in console window.
 
Posted: 07:12am
16 Apr 2022
Copy link to clipboard
matherp
Guru

  Quote  but COPY/PASTE not work in console window.


Correct. And it won't be
 
Posted: 07:14am
16 Apr 2022
Copy link to clipboard
Kabron
Regular Member


  matherp said  
  Quote  but COPY/PASTE not work in console window.


Correct. And it won't be

Very discomfortable!
 
Posted: 01:50pm
20 Apr 2022
Copy link to clipboard
thwill
Guru


Hi Peter,

Pretty sure this is a bug and different from the CMM2, but I only have MMB4L to compare against at the moment:

> Dim a%
> Poke Var a%, 0, 255
> ? Peek(Var a%, 0)
-1


Output from PEEK(VAR var, offset) should be an unsigned/byte value = 255.

Best wishes,

Tom
 
Posted: 02:33pm
20 Apr 2022
Copy link to clipboard
matherp
Guru

  Quote  Pretty sure this is a bug and different from the CMM2,



MMBasic.zip
 
Posted: 09:15am
21 Apr 2022
Copy link to clipboard
thwill
Guru


Thanks Peter,

That issue is fixed.

1. Unfortunately this appears to be a regression from the previous build:
> list "append_bug.bas"
Option Console Both
Dim f$ = "append.txt"
On Error Skip
Kill f$
Open f$ For Output As #1
Print #1, "Hello World"
Close #1
Open f$ For Append As #1
? Eof(#1) ' Works if you comment out this line
Print #1, "Goodbye Peter"
Close #1
> run "append_bug.bas"
0
Error in line 10: File write
>


2. Also (in this and previous build) this crashes MMB4W rather than reporting a "Syntax" error
Dim i% = 1
? Peek(Var i%)


Best wishes,

Tom
 
   Page 14 of 30    
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025