Welcome, Guest
You have to register before you can post on our site.

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 324
» Latest member: Martinstobe
» Forum threads: 1,747
» Forum posts: 17,908

Full Statistics

Latest Threads
The Crucial Role of Getti...
Forum: Utilities
Last Post: Martinstobe
Yesterday, 04:41 PM
» Replies: 0
» Views: 18
The Essential Role of See...
Forum: Utilities
Last Post: Martinstobe
Yesterday, 12:32 PM
» Replies: 0
» Views: 18
astuce pour survivre fina...
Forum: Utilities
Last Post: coletteleger
05-14-2025, 04:47 AM
» Replies: 0
» Views: 56
trouver permis de conduir...
Forum: Utilities
Last Post: nicolasrene
05-05-2025, 05:24 AM
» Replies: 0
» Views: 58
LIGHTBAR Menu
Forum: Programs
Last Post: nicolasrene
05-05-2025, 05:08 AM
» Replies: 15
» Views: 1,070
Learning Pallet Rack Safe...
Forum: Utilities
Last Post: Sandrapew
04-03-2025, 09:36 AM
» Replies: 0
» Views: 62
Choosing New Versus or Pr...
Forum: Utilities
Last Post: Sandrapew
03-18-2025, 01:11 AM
» Replies: 0
» Views: 65
The QB64 IDE shell
Forum: Utilities
Last Post: JasonPag
09-16-2024, 05:37 PM
» Replies: 9
» Views: 1,161
Importance regarding Ches...
Forum: Utilities
Last Post: JasonPag
09-01-2024, 06:34 PM
» Replies: 0
» Views: 92
Chess and Analysis and En...
Forum: Utilities
Last Post: JasonPag
08-28-2024, 02:37 PM
» Replies: 0
» Views: 94

 
  REDIM, TYPE, and STRING Woes
Posted by: TerryRitchie - 04-12-2023, 05:57 AM - Forum: General Discussion - Replies (16)

Ok, been pulling my hair out for last 4 hours until I realized what was going on.

I have a TYPE with 3 integers and a string:

TYPE MYTYPE
    INT1 AS INTEGER
    INT2 AS INTEGER
    INT3 AS INTEGER
    INFO AS STRING
END TYPE

Then used it as so:

REDIM MYVARIABLE(1) AS MYTYPE

So far so good. As I start putting data into the array I need to resize it from time to time:

REDIM _PRESERVE MYVARIABLE(UBOUND(MYVARIABLE) + 1) AS MYTYPE

Still good right? Nope. The previous data gets completely garbled. The problem you ask?

INFO AS STRING

Change it to:

INFO AS STRING * 20

and all is good in QB64 land.

It seems variable length strings are a no-no when using REDIM _PRESERVE

If this is already a known issue then somehow I have missed it all these years. If it isn't then this is a warning letting others know this happens.

I was ready to throw my joystick through my screen until it finally dawned on me as to what may have been happening. The integers I was storing ranged from 1 to 6 but somehow they were changing to 16, 57, 3471, etc.. I thought maybe I was going nuts for a while, LOL.

Ugh.

Print this item

  Web-based paint app DPaint.js
Posted by: RhoSigma - 04-11-2023, 08:37 PM - Forum: QBJS, BAM, and Other BASICs - Replies (12)

Not strictly connected to QBJS, BAM or other BASICs, but seems the best place to point you to another stunning Web-based application, especially for the graphicans among us.

DPaint.js is inspired by the legendary Commodore Amiga Program "DeluxePaint". Just select "Documentation" from the "Help" menu, there you find some feature highlights and a introduction video.

Print this item

  Two or more finger on touchpad manager
Posted by: TempodiBasic - 04-11-2023, 08:19 PM - Forum: General Discussion - Replies (3)

CONST QB64 = QB64pe

Hi QB64 coders
QB64 developers
QB64 members of community

in what  manner do you manage modern input  mouse like touchpad of notebook?
Today new notebooks have customized input from touchpad with 2 or 3 or 4 fingers on it ....
how to catch and manage these new mouse input?
Where do you find and use the code for managing these modern mouse input?
In the old '80-'90 it was the new frontier managing mouse input (see call interrupt &H33, call absolute with binary code into an array), today the input with multiple fingers from a touchpad or another kind of input device is the new frontier.
I have get no good search result on stackoverflow.

Thanks for feedback boys and girls of QB64pe

Print this item

  how to pass parameters to H file?
Posted by: Petr - 04-11-2023, 03:30 PM - Forum: Help Me! - Replies (8)

I am confused. What is the compiler trying to do?

I try to pass a parameter of type INT or Float and it keeps telling me that the conversion from type INT* to INT and from Float to Float* cannot be performed - what does this mean? Here is a sample code to QB64PE and below that the contents of the H file. It should be fine (but it would have to work) - what did I do wrong?

QB64 code:

Code: (Select All)
Declare Library "plus"
    Function calc_plus% (a As Integer, b As Integer)
End Declare

c% = calc_plus(5, 6)
Print c%

plus.h file code:
Code: (Select All)
int calc_plus (int a, int b)
{
    int c = a + b;
    return c;
}


I'm not big friends with the C language...

Print this item

  QBJS - Fun Facts!
Posted by: dbox - 04-10-2023, 08:46 PM - Forum: QBJS, BAM, and Other BASICs - Replies (16)

Starting a thread here to post fun facts about QBJS that you might not know.

Fun Fact #1 - You can define optional parameters!

Code: (Select All)
PrintLines "First Test"
PrintLines "Second Test", 4
PrintLines "Third Test", , " -> "

Sub PrintLines (msg As String, lines As Integer, prefix As String)
    If lines = undefined  Then lines = 2   ' default to 2 lines
    If prefix = undefined Then prefix = "" ' default to blank prefix
   
    Dim i As Integer
    For i = 1 To lines
        Print prefix; msg
    Next i
End Sub

Output:
Code: (Select All)
First Test
First Test
Second Test
Second Test
Second Test
Second Test
-> Third Test
-> Third Test

Try it out on QBJS

Print this item

  Centering text inside char bax
Posted by: bplus - 04-08-2023, 05:05 PM - Forum: Utilities - Replies (14)

Code: (Select All)
_Title "Centering text inside a box of X's" ' b+ 2023-04-08
Screen _NewImage(800, 600, 32)
f& = _LoadFont("c:\WINDOWS\Fonts\arial.ttf", 24, "bold")
_Font f&
_PrintMode _KeepBackground

MessageBox "Centering text inside a box of X's, ...zzz", "X", &HFF0000FF, &HFFFFFFFF
Sleep
Cls
' OK generalize this for any meessage, character block and font size

f& = _LoadFont("c:\WINDOWS\Fonts\cambriab.ttf", 30, "Monospace")
f& = _LoadFont("c:\WINDOWS\Fonts\cambriab.ttf", 40)
_Font f&
MessageBox "bplus was here, ...zzz", "b", &HFFFF0000, &HFFBBBBFF

Sleep
Cls
f& = _LoadFont("c:\WINDOWS\Fonts\inkfree.ttf", 50)
_Font f&
MessageBox "bplus was here, ...zzz", "+", &HFFFF0000, &HFFBBBBFF
Sleep

' assuming font is loaded and _font handle activated   AND  _PrintMode _KeepBackground
' assuming message will fit on one line inside screen plus 4 extra Box characters
Sub MessageBox (message$, boxCharacter$, boxColor~&, PrintColor~&)
    ' note: "X" was the original Box Character used
    pwMessage = _PrintWidth(message$) ' print width of message$
    pwX = _PrintWidth(boxCharacter$) '  print width of 1 X
    addxs = pwMessage + 4 * pwX '       width of X box
    ' X + space + message + space + X  AND spaces same width as X = 4 * pwX

    fh = _FontHeight
    y = (_Height - 5 * fh) / 2 '        y start x's    top corner of box

    ' how many x's fit in add2x
    nx = (addxs + .5 * pwX) \ pwX '     round up to convert message line to a number of X's to print

    pwNX = _PrintWidth(String$(nx, boxCharacter$))
    x = (_Width - pwNX) / 2 '          x start x's    left side of box
    diff = pwNX - pwMessage '          what is difference between n printed X's and message line?

    Line (x, y)-Step(pwNX, 5 * fh), boxColor~&, BF
    Color PrintColor~&
    For i = 0 To 4
        If i = 0 Or i = 4 Then
            _PrintString (x, y + (i * fh)), String$(nx, boxCharacter$)
        Else
            _PrintString (x, y + (i * fh)), boxCharacter$
            _PrintString (x + pwNX - pwX, y + (i * fh)), boxCharacter$
        End If
    Next
    _PrintString (x + .5 * diff, y + 2 * fh), message$ ' for perfect center, add .5*difference

End Sub

       

Print this item

  Changing font-size in _rgb32 mode
Posted by: PhilOfPerth - 04-08-2023, 01:57 AM - Forum: Help Me! - Replies (17)

Is there a (simple) way to increase font- size during programme execution when using the _rgb32 screen? If not, could this be made possible?

Print this item

  BUG in 3.6.0 ?
Posted by: mdijkens - 04-07-2023, 09:41 AM - Forum: General Discussion - Replies (9)

I have an older program that used to run fine but now exits unexpectedly in 3.6.0 without any message.

Below a snippet of what I pinned down the error to: (r$ = Mid$(arr$(i&), 80, 20) in processArr&)

Code: (Select All)
Const RECS = 10000000
Dim Shared arr$(RECS)

Print fillArr
Print processArr

Function fillArr&
    For i& = 0 To RECS
        arr$(i&) = Space$(150)
    Next i&
    fillArr& = i&
End Function

Function processArr&
    For i& = 0 To RECS
        r$ = Mid$(arr$(i&), 80, 20)
    Next i&
    processArr& = i&
End Function

I expect it to be some kind of memory error.

(and Yes I know this is an array of 1.5GB, but it used to work up to 2GB)

Print this item

  Read / Allocate Cores
Posted by: dISP - 04-06-2023, 12:17 PM - Forum: Help Me! - Replies (10)

Anyone know of commands in QB64 that:

1) Reads the number of available cores "cores"
2) Assigns or allocates an X number of cores to a program?

Regards - dsip

Print this item

  IDE suggestion
Posted by: NasaCow - 04-06-2023, 02:45 AM - Forum: General Discussion - Replies (4)

Not sure where a good place to suggest ideas for improving QB64's IDE so I am dropping it here. I'd be happy to do it right next time, if this isn't, if someone kindly points me to the right place.

Anyways, my idea is having a way to mark functions and subs in the SUBs menu (you know the one you get with F2). Be useful to mark complete, in-progress, or place holder and sort by such a flag. Just my two cents.

Have a lovely day or evening wherever you may be  Cool

Print this item