• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
    • 軟件測試技術
    • 軟件測試博客
    • 軟件測試視頻
    • 開源軟件測試技術
    • 軟件測試論壇
    • 軟件測試沙龍
    • 軟件測試資料下載
    • 軟件測試雜志
    • 軟件測試人才招聘
      暫時沒有公告

    字號: | 推薦給好友 上一篇 | 下一篇

    Rational 識別 Delphi TDBGrid的解決方法

    發布: 2008-9-18 14:11 | 作者: pcl | 來源: 51testing | 查看: 68次 | 進入軟件測試論壇討論

    領測軟件測試網

    雖然賦值成功,但是datagridMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">無法顯示你需要的數據(這里需要研究一下),因為時間的緣故,就用第二種方式坐標的方式來實現,考慮多平臺共享使用,寫SetGridFocus函數,思路這樣得到tdbgrid對象,得到其中column的屬性寬高,計算坐標(這些都在函數內部實現),其中移動有個固定值24是追蹤tdbgrid代碼中defaultHeight24

    最后代碼如下:

    Sub SetGridFocus(strObject as String, strCol as String, strRow as String, strValue as String)

      

       Dim iResult as Integer

       Dim iCount as Integer

       Dim ColWidth() as integer

       Dim iWidth as Integer

      

       Dim strColPos as Integer

       Dim strRowPos as Integer

       Dim strCor as String

      

       Dim iTemp as integer

      

       strColPos = 0

       strRowPos = 0

       iTemp = 0

      

       SQAGetProperty strObject ,"Columns.Count", iCount

      

       if iCount <> 0  then

          Redim ColWidth(iCount - 1)

         

          While iTemp < iCount

             iResult = SQAGetProperty (strObject, "Columns.Items(" + CStr(iTemp) +").Width",iWidth)

             ColWidth(iTemp) = iWidth

             iTemp = iTemp + 1

         wend

         

       End if

          strColPos = 20

          if CInt(strCol) <> 1 then

              for iTemp = 1 to CInt(strCol)-1

                    strColPos = strColPos+ ColWidth(iTemp-1)

              next iTemp         

          End if         

         

          for iTemp = 1 to CInt(strRow)

             strRowPos = 24 +strRowPos

          next iTemp

         

         

         

       strCor = "Coords=" & strColPos &","+CStr(strRowPos)

      

      

       GenericObject Click, strObject, strCor

       InputKeys strValue

       stop

       strCor = "Coords=" & strColPos &","+CStr(strRowPos + 24)

       GenericObject Click, strObject, strCor  

      

      

    End Sub

     

    上編寫的還有很多疏漏的地方,對于浮動文本框賦值成功,卻無法改動tdbgrid中的值沒有深入研究,該函數在實際應用中還有個小問題,沒有做到很完全“周到“ ,下回有時間改正。

    備注:

    最后我把代碼進行優化和擴展,開發了針對grid的相關函數,下邊是其中之一

    //得到列數

    Function GetColCount(sGridRecogStr as String) as Integer

        Dim Result as Integer

        Dim vValue as Variant

        Dim sLogMessage as String

        Dim sErrorMessage as String

     

        grdGetRowCount = -1

     

        Result = SQAGetProperty(sGridRecogStr, "Column.Count", vValue)

        If Result = sqaSuccess Then

            GetRowCount = CInt(vValue)

        Else

            sLogMessage = "無法得到Grid的列數

            sErrorMessage = "[" & CStr(Result) & " = " & Error(Result) &"]"

            SQALogMessage sqaFail, sLogMessage, sErrorMessage

        End If

       

    End Function

     

    就到這里吧。

    延伸閱讀

    文章來源于領測軟件測試網 http://www.kjueaiud.com/

    22/2<12

    關于領測軟件測試網 | 領測軟件測試網合作伙伴 | 廣告服務 | 投稿指南 | 聯系我們 | 網站地圖 | 友情鏈接
    版權所有(C) 2003-2010 TestAge(領測軟件測試網)|領測國際科技(北京)有限公司|軟件測試工程師培訓網 All Rights Reserved
    北京市海淀區中關村南大街9號北京理工科技大廈1402室 京ICP備10010545號-5
    技術支持和業務聯系:info@testage.com.cn 電話:010-51297073

    軟件測試 | 領測國際ISTQBISTQB官網TMMiTMMi認證國際軟件測試工程師認證領測軟件測試網

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>