SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 4 of 4
  1. #1
    Junior Member
    Join Date
    Nov 2005
    Location
    Cambridge
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    TrueGrid Colour Property

    I am testing an application that is :-
    32 bit and uses VB6 and ActiveX true grid.

    I am running Windows XP.

    Lots of the windows forms in the application display data in ActiveX Grids

    I need a clever function to get hold of the contents of a cell and the style of a cell to be able to interrogate the colour property. i.e.
    Is the first letter red or
    is the cell coloured pink instead of blue

    Any ideas would be much appreciated

    I have tried using .ForeColor and .BackColor but they both return negative numbers.

  2. #2
    Advanced Member
    Join Date
    Jan 2002
    Location
    Detroit, Michigan
    Posts
    522
    Post Thanks / Like
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: TrueGrid Colour Property

    I assume you are using the .Object to get a reference to the ActiveX control. If you have done this then you need to find the method that gives you the cell and then find the method (on the cell) to get the colours out.
    //*eggbox

  3. #3
    Junior Member
    Join Date
    Nov 2005
    Location
    Cambridge
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: TrueGrid Colour Property

    I attach to the cell using a function MakeActiveCellByRowNumber and this works for finding a specific cell and typing in text.

    I then use the property .ForeColor but get a negative number.

    Is there somehting else you thiunk I might consider or is my approach completely wrong ?

    This is TestPartner script and associated Shared module functions. :-

    Sub Main
    VBWindow("WinPath Main Window").Attach
    VBWindow("ResultEditor", tpAttachChild).Attach


    'ActiveX ("Name=tgdResults ClassName=TDBGrid")

    sGrid.Connect "Name=tgdResults ClassName=TDBGrid

    For lngLoopCount = 0 To 8

    sGrid.MakeActiveCellByRowNumber lngLoopCount, "Tests"

    strBackColor = sGrid.Object.BackColor
    strForeColor1 = sGrid.Object.ForeColor
    strForeColor2 = sGrid.Cell_ForeColor
    strText = sGrid.Column_GetData(3)

    Next

    strText = VBLabel("Name=lblAuthByComment").Caption

    End Sub

    Shared Module - sGrid
    ----------------------
    Option Explicit

    Dim oTDBGrid As TDBGrid
    Dim oGridName As String
    Dim RowObject As TDBGrid
    Dim CurrentRow As Long
    Dim CurrentColumn As Long
    Dim tTDBGrid As TActiveX

    Function Connect(GridName As String) As Boolean

    Dim intLoopCount As Integer
    intLoopCount = 1

    On Error GoTo lblError

    Set tTDBGrid = ActiveX(GridName)
    oGridName = GridName

    Do
    Set oTDBGrid = Nothing
    Sleep 100, tpPauseMilliSeconds
    Set oTDBGrid = ActiveX(oGridName).Object

    Loop While oTDBGrid.Columns.Count = 0

    Connect = True

    Exit Function

    lblError:
    ' loop waiting for grid to appear

    intLoopCount = intLoopCount + 1
    If intLoopCount < 1 Then
    Sleep 1
    Resume
    Else
    Connect = False
    End If
    End Function

    Function CellObject() As TDBGrid

    Set CellObject = oTDBGrid

    End Function

    Function MakeActiveCellByRowNumber(RowNumber As Long, ColumnHeader As String) As Boolean
    Dim NoOfColums As Long
    Dim oColumn As Long
    Dim ColumnFound As Boolean
    Dim NoOfRows As Long
    Dim oRow As Long
    Dim RowFound As Boolean


    ColumnFound = False
    NoOfColums = oTDBGrid.Columns.Count - 1 ' zero based.

    For oColumn = 0 To NoOfColums

    If ColumnHeader = oTDBGrid.Columns.Item(oColumn).Caption Then

    ColumnFound = True
    Exit For

    End If


    Next oColumn

    If ColumnFound = True Then

    SetActiveRowByNumber RowNumber
    oTDBGrid.Col = oColumn

    End If

    MakeActiveCellByRowNumber = ColumnFound

    End Function

  4. #4
    Advanced Member
    Join Date
    Jan 2002
    Location
    Detroit, Michigan
    Posts
    522
    Post Thanks / Like
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: TrueGrid Colour Property

    I don't know much about the TBGrid but it looks like you are doing everything correctly in terms of using .Object. The only thing I can think of is that the colours being used are not handled by these properties.

    The only thing I can think of is that the colour is set for the cell rather than the grid as a whole. So, if you get the cell and ask it for its colour this would give you what you want.
    //*eggbox

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 01:49 AM.

Copyright BetaSoft Inc.