Announcement

Collapse
No announcement yet.

LISTBOX indexes

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • LISTBOX indexes

    Hello all...

    Why is it that the DDT functions in PBDLL use one for the LISTBOX base index and the default WindowsAPI use a zero based index?

    Cheers!

    -------------
    Cheers

  • #2
    It's just traditional. Many things in the Basic language set originate with the base of 1 rather than zero.

    For example, reading the first character from a string would be done with the reference of 1 (ie, MID$(A$,1,n)); Binary files (by default) have a base equal to 1; etc...

    I'm sure you get my drift.



    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      It's just traditional. Many things in the Basic language set originate with the base of 1 rather than zero.
      For example, reading the first character from a string would be done with the reference of 1 (ie, MID$(A$,1,n)); Binary files (by default) have a base equal to 1; etc...
      Binary files in PB *for WINDOWS* originate at one; binary files in PB/DOS used zero as the default. Microsoft BASICs use zero by default.

      PB's main "indexed" tool, the array, uses zero; of course, I don't think I've ever seen a BASIC with 1-based default arrays.

      I don't think it's traditional: it's more or less that both PB and Microsoft had to pick "something" for listbox indexes, and just happened to choose differently.

      MCM

      Michael Mattias
      Tal Systems Inc. (retired)
      Racine WI USA
      [email protected]
      http://www.talsystems.com

      Comment


      • #4
        Michael, you are correct in that the default base for binary files is zero in PB/DOS, but this is not really pertinent given that the question centers around the DDT LISTBOX control in the PowerBASIC for Windows forum...

        Besides, there are still other items use a "base" of 1, such as DATACOUNT, READ$(), PARSECOUNT, PARSE$(), LEN(), SIZEOF(), etc.


        ------------------
        Lance
        PowerBASIC Support
        mailto:[email protected][email protected]</A>
        Lance
        mailto:[email protected]

        Comment

        Working...
        X