• <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  評(píng)論-7  文章-0  trackbacks-0

            環(huán)境WindowsXP,BCB6.0(UPD4 (English)
            Form1(主Form),F(xiàn)orm1上有Button1,點(diǎn)擊Button1顯示Form2。
            Form2上有一個(gè)RadioGroup1和Edit1,在Form2的OnShow事件中,
            進(jìn)行RadioGroup1->ItemIndex = StrToInt(Edit1->Text);賦值操作。Edit1->Text默認(rèn)值0。
            Form2顯示后,在界面上選擇與StrToInt(Edit1->Text)不同的選項(xiàng)后關(guān)閉Form2。假設(shè)選擇了第二項(xiàng)。
            回到Form1,重新打開Form2,這時(shí)應(yīng)該顯示的是RadioGroup1->ItemIndex = 0;
            可是結(jié)果卻顯示為第二項(xiàng)。


            PS:Form1,F(xiàn)orm2都是自動(dòng)創(chuàng)建的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 楚天清秋 閱讀(1725) 評(píng)論(1)  編輯 收藏 引用 所屬分類: C++ Builder

            評(píng)論:
            # re: BCB的RadioGroup控件的ItemIndex屬性BUG! 2011-01-23 11:23 | 人渣
            用showmod.. 顯示模式對(duì)話框看看。
            要是還不行,就用hide,不用close。
            似乎也見過。  回復(fù)  更多評(píng)論
              
            青青热久久综合网伊人| 香蕉99久久国产综合精品宅男自| 欧美日韩精品久久免费| 香蕉久久夜色精品升级完成| 精品久久一区二区| 国内精品久久久久国产盗摄| 久久午夜综合久久| 少妇内射兰兰久久| 久久久久亚洲精品无码网址| 亚洲中文字幕无码久久综合网| 国产一级做a爰片久久毛片| 久久精品国产99久久香蕉| 亚洲精品乱码久久久久66| 国产精品美女久久久久网| 久久久久久久97| 亚洲国产精品嫩草影院久久| 大伊人青草狠狠久久| 欧美久久久久久| 久久精品无码一区二区日韩AV| 国产毛片欧美毛片久久久| 久久996热精品xxxx| 久久国产一区二区| 麻豆av久久av盛宴av| 久久综合亚洲色HEZYO国产| 精品久久久久久成人AV| 亚洲国产精品综合久久一线| 热99re久久国超精品首页| 色欲久久久天天天综合网精品| 色综合久久88色综合天天 | 亚洲国产精品久久久久婷婷老年| 综合网日日天干夜夜久久| 欧美久久久久久午夜精品| 国产精品成人99久久久久| 成人综合伊人五月婷久久| 色综合久久综合中文综合网| 成人综合久久精品色婷婷| 久久强奷乱码老熟女| 亚洲国产成人精品91久久久| 久久久中文字幕日本| 亚洲精品无码久久久| 日本五月天婷久久网站|