• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            隨筆-22  評論-7  文章-0  trackbacks-0

            環境WindowsXP,BCB6.0(UPD4 (English)
            Form1(主Form),Form1上有Button1,點擊Button1顯示Form2。
            Form2上有一個RadioGroup1和Edit1,在Form2的OnShow事件中,
            進行RadioGroup1->ItemIndex = StrToInt(Edit1->Text);賦值操作。Edit1->Text默認值0。
            Form2顯示后,在界面上選擇與StrToInt(Edit1->Text)不同的選項后關閉Form2。假設選擇了第二項。
            回到Form1,重新打開Form2,這時應該顯示的是RadioGroup1->ItemIndex = 0;
            可是結果卻顯示為第二項。


            PS:Form1,Form2都是自動創建的Form。

            From1.cpp代碼如下
            //----------------------------Head Begin-----------------------------------------------
            #ifndef Unit1H
            #define Unit1H
            #include <Classes.hpp>
            #include <Controls.hpp>
            #include <StdCtrls.hpp>
            #include <Forms.hpp>
            #include <ExtCtrls.hpp>
            //---------------------------------------------------------------------------
            class TForm1 : public TForm
            {
            __published: // IDE-managed Components
                    TButton *Button1;
                    void __fastcall Button1Click(TObject *Sender);
            private: // User declarations
            public:  // User declarations
                    __fastcall TForm1(TComponent* Owner);
            };
            //---------------------------------------------------------------------------
            extern PACKAGE TForm1 *Form1;
            //---------------------------------------------------------------------------
            #endif
            //---------------------------Head End------------------------------------------------


            //---------------------------Cpp Begin------------------------------------------------
            #include <vcl.h>
            #pragma hdrstop

            #include "Unit1.h"
            #include "Unit2.h"
            //---------------------------------------------------------------------------
            #pragma package(smart_init)
            #pragma resource "*.dfm"
            TForm1 *Form1;
            //---------------------------------------------------------------------------
            __fastcall TForm1::TForm1(TComponent* Owner)
                    : TForm(Owner)
            {
            }
            //---------------------------------------------------------------------------

            void __fastcall TForm1::Button1Click(TObject *Sender)
            {
                Form2->Show();
            }
            //--------------------------Cpp End-------------------------------------------------


            Form2代碼如下
            //--------------------------Form2  Head Begin-------------------------------------------------

            #ifndef Unit2H
            #define Unit2H
            //---------------------------------------------------------------------------
            #include <Classes.hpp>
            #include <Controls.hpp>
            #include <StdCtrls.hpp>
            #include <Forms.hpp>
            #include <ExtCtrls.hpp>
            //---------------------------------------------------------------------------
            class TForm2 : public TForm
            {
            __published: // IDE-managed Components
                TRadioGroup *RadioGroup1;
                TEdit *Edit1;
                void __fastcall FormShow(TObject *Sender);
            private: // User declarations
            public:  // User declarations
                __fastcall TForm2(TComponent* Owner);
            };
            //---------------------------------------------------------------------------
            extern PACKAGE TForm2 *Form2;
            //---------------------------------------------------------------------------
            #endif
            //-----------------------------Form2 Head End----------------------------------------------


            //-----------------------------From2 Cpp Begin----------------------------------------------

            #include <vcl.h>
            #pragma hdrstop

            #include "Unit2.h"
            //---------------------------------------------------------------------------
            #pragma package(smart_init)
            #pragma resource "*.dfm"
            TForm2 *Form2;
            //---------------------------------------------------------------------------
            __fastcall TForm2::TForm2(TComponent* Owner)
                : TForm(Owner)
            {
            }
            //---------------------------------------------------------------------------

            void __fastcall TForm2::FormShow(TObject *Sender)
            {
                RadioGroup1->ItemIndex = StrToInt(Edit1->Text);

            }
            //------------------------------From2 Cpp End---------------------------------------------


            解決方法:
            在TForm2::FormShow加入RadioGroup1->SetFocus(); 

            void __fastcall TForm2::FormShow(TObject *Sender)
            {
                RadioGroup1->SetFocus(); //加入
                RadioGroup1->ItemIndex = StrToInt(Edit1->Text);

            }

            posted on 2010-07-05 15:53 楚天清秋 閱讀(1723) 評論(1)  編輯 收藏 引用 所屬分類: C++ Builder

            評論:
            # re: BCB的RadioGroup控件的ItemIndex屬性BUG! 2011-01-23 11:23 | 人渣
            用showmod.. 顯示模式對話框看看。
            要是還不行,就用hide,不用close。
            似乎也見過。  回復  更多評論
              
            99久久成人国产精品免费| 亚洲综合久久夜AV | 久久久WWW成人免费精品| 久久国产乱子伦精品免费强| 97久久超碰国产精品2021| 99久久精品费精品国产一区二区 | 国内精品久久久久久麻豆| 亚洲精品国产自在久久| 久久精品天天中文字幕人妻| 久久久久人妻一区精品| 久久夜色精品国产噜噜亚洲AV | 99久久综合狠狠综合久久止| 办公室久久精品| 国内精品久久久久影院免费| 欧美久久天天综合香蕉伊| 精品久久一区二区| 久久久久久久91精品免费观看| 久久精品国产亚洲精品2020| 久久九色综合九色99伊人| 国产精品女同久久久久电影院| 久久精品国产99国产精品导航| 久久国产三级无码一区二区| 久久国产色av免费看| 久久国产精品偷99| 国产∨亚洲V天堂无码久久久| 亚洲综合久久夜AV | 久久午夜综合久久| 久久精品成人影院| 久久九九亚洲精品| 伊人久久综合热线大杳蕉下载| 26uuu久久五月天| 99久久精品费精品国产一区二区| 色婷婷综合久久久久中文| 伊人久久大香线蕉综合网站| 久久激情五月丁香伊人| 久久电影网| 亚洲国产精品久久久久婷婷软件| 久久久久无码精品国产不卡| 久久人人爽人人爽人人片av高请| 中文字幕久久波多野结衣av| 精品午夜久久福利大片|