LoginSignup
0
0

More than 5 years have passed since last update.

C++ Builder 10.2 Tokyo > TOpenDialog > FilterIndex > 1から始まる > Off-by-one errorに注意

Last updated at Posted at 2018-05-29
動作環境
RAD Studio 10.2 Tokyo Update 3
Windows 10 Pro (64bit) バージョン 1803 (April 2018 Update)

index from 1

Set FilterIndex to 1 to choose the first file type in the list as the default, or set FilterIndex to 2 to choose the second file type as the default, and so forth.

一つ目の項目を選択するためには「1」をFilterIndex に代入する。

C++ではインデックスは0始まりのため、この点はOff-by-one errorにつながりそう。

delphiのString > index from 1

C++ BuilderはDelphiの実装がベースであると認識している。
Delphiの実装に基づき1始まりのインデックスなのだろうか。

下記を見つけた。
https://stackoverflow.com/questions/1143340/how-to-get-the-first-element-in-a-string

answered Jul 17 '09 at 13:41
Ondrej Kelle

Strings are 1-based:

FilterIndex が使われるのはStringではなくて、StringListだろう。
そちらも1-basedになっているようだ。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0