Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QB64 IDE bug and an SNL moment...
#10
Au contraire!

Press any key then type in something you want added to the list.
Code: (Select All)
FOR i = 1 TO 50
    REDIM _PRESERVE c$(i)
    c$(i) = LTRIM$(STR$(i))
NEXT
WIDTH 80, 25
idx = -1: GOSUB dsp

DO
    _LIMIT 60
    WHILE _MOUSEINPUT
        mw = mw + _MOUSEWHEEL
    WEND
    IF mw <> oldmw THEN
        adj = SGN(mw - oldmw): mw = 0
        IF idx > 0 AND adj < 0 OR idx <= UBOUND(c$) - (_HEIGHT - 1) AND adj > 0 THEN GOSUB dsp
    END IF
    oldmw = mw
    b$ = INKEY$
    IF LEN(b$) THEN
        LOCATE 1, 10: LINE INPUT "Add what to list? "; ans$
        IF LEN(ans$) THEN
            REDIM _PRESERVE c$(UBOUND(c$) + 1)
            c$(UBOUND(c$)) = ans$
            idx = -1: GOSUB dsp
        END IF
    END IF
LOOP

dsp:
CLS
IF idx < 0 THEN
    idx = UBOUND(c$) - (_HEIGHT - 2)
    IF idx <= 1 THEN idx = 0
ELSE
    idx = idx + adj
END IF
LOCATE 1, 1
i = idx: j = 0
DO
    i = i + 1
    j = j + 1: LOCATE j, 1
    PRINT c$(i)
LOOP UNTIL CSRLIN = _HEIGHT - 1 OR i = UBOUND(c$)
RETURN

So you can add without worry of counting. Also, for testing, you don't need to change a DIM statement plus the array statement. Another plus is this method allows you to use ubounds() instead of a terminal counter.

Pete
Reply


Messages In This Thread
QB64 IDE bug and an SNL moment... - by Pete - 11-12-2022, 03:09 AM
RE: QB64 IDE bug and an SNL moment... - by Pete - 11-12-2022, 03:22 AM
RE: QB64 IDE bug and an SNL moment... - by Pete - 11-12-2022, 03:32 AM
RE: QB64 IDE bug and an SNL moment... - by Pete - 11-12-2022, 05:54 AM
RE: QB64 IDE bug and an SNL moment... - by jcm - 11-16-2022, 05:10 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Is this a bug with Round or is it just me BarrySWTP 10 1,293 07-07-2025, 08:40 PM
Last Post: BarrySWTP
  Exiting FOR NEXT, maybe a bug? Version 4.1.0 on Linux Circlotron 4 866 05-09-2025, 02:22 AM
Last Post: Circlotron
  IDE suggestions / editor questions madscijr 14 2,387 05-01-2025, 12:56 PM
Last Post: madscijr
  I have fallen in a bug or weird behaviour TempodiBasic 2 694 10-08-2024, 06:09 PM
Last Post: TempodiBasic
  IDE almost flatlines 4 of 4 cpus - linux - any cure? desA 5 1,078 07-28-2024, 02:49 PM
Last Post: bplus

Forum Jump:


Users browsing this thread: 1 Guest(s)