Sign in to follow this  
Followers 0
Holger

COM help needed

7 posts in this topic

#1 ·  Posted (edited)

Hi :mellow:

I tried it for a couple of days but cannot find a solution to create a full working MSFlexGrid6-control. :)

Here is the code:

#include <GUIConstants.au3>

$hMainGUI       = GUICreate('COM Test')
$oGrid          = ObjCreate('MSFlexGridLib.MSFlexGrid')
$nGridCtrl      = GUICtrlCreateObj($oGrid, 0, 25, 200, 200)
; Only for XP SP2
ControlMove($hMainGUI, '', 'MSFlexGridWndClass1', 0, 25, 200, 200)

GUISetState()

With $oGrid
    .AllowBigSelection = 1
    .AllowUserResizing = 1
    .Cols = 3
    .Rows = 3
    .FixedCols = 1
    .FixedRows = 1
    .FocusRect = 2
    .SelectionMode = 0
    .Appearance = 0
EndWith

; This lines works
$oGrid.Col = 0
$oGrid.Row = 0
$oGrid.Text = 'Text1'

; This one not
$oGrid.TextMatrix(0, 1) = 'Text2'

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd

Exit

Does anyone has an idea what could be the problem or is this maybe not possible?

Thanks

Holger

Edited by Holger

Share this post


Link to post
Share on other sites



Hi :mellow:

I tried it for a couple of days but cannot find a solution to create a full working MSFlexGrid6-control. :)

I don't have MSFlxGrd.ocx on my system, so $oGrid is returning 0 - is this the problem you are having or something else?

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I don't have MSFlxGrd.ocx on my system, so $oGrid is returning 0 - is this the problem you are having or something else?

Dale

Just tested a bit ... it doesn't update the grid, but it does retrieve its current value correctly.

When i run this it does show the "Text1" value for the 2 cells:

#include <GUIConstants.au3>

$hMainGUI       = GUICreate('COM Test')
$oGrid          = ObjCreate('MSFlexGridLib.MSFlexGrid')
$nGridCtrl      = GUICtrlCreateObj($oGrid, 0, 25, 200, 200)
; Only for XP SP2
ControlMove($hMainGUI, '', 'MSFlexGridWndClass1', 0, 25, 200, 200)

GUISetState()

With $oGrid
    .AllowBigSelection = 1
    .AllowUserResizing = 1
    .Cols = 3
    .Rows = 3
    .FixedCols = 1
    .FixedRows = 1
    .FocusRect = 2
    .SelectionMode = 0
    .Appearance = 0

; This lines works
    .Col = 0
    .Row = 0
    .Text = 'Text1'
    .Col = 1
    .Row = 1
    .Text = 'Text1'

; This one not
    For $x = 0 To $oGrid.Cols -1
        For $y = 0 To $oGrid.Rows -1
            .TextMatrix($x, $y) = 'x\'
            ConsoleWrite('@@ Debug(30) : .TextMatrix($x, $Y) = ' & .TextMatrix($x, $Y) & @lf & '>Error code: ' & @error & @lf);### Debug Console
        Next
    Next
EndWith

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd

Exit
Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Thank you both for looking at :)

Yeah, you can read the text values with TextMatrix() but cannot set.

I have no idea at the moment cause also some other options don't work, like i.e. ColWidth .

I give up this for now.

Maybe someone knows another table-control (not Excel) which works.

I think it will end with using a simple listview with single-selection... :mellow:

So long

Holger

Share this post


Link to post
Share on other sites

#include <GUIConstants.au3>

$hMainGUI = GUICreate('COM Test')
$oGrid = ObjCreate('MSFlexGridLib.MSFlexGrid')
$nGridCtrl = GUICtrlCreateObj($oGrid, 0, 25, 200, 200)
; Only for XP SP2
ControlMove($hMainGUI, '', 'MSFlexGridWndClass1', 0, 25, 200, 200)

GUISetState()

With $oGrid
   .AllowBigSelection = 1
   .AllowUserResizing = 1
   .Cols = 3
   .Rows = 3
   .FixedCols = 1
   .FixedRows = 1
   .FocusRect = 2
   .SelectionMode = 0
   .Appearance = 0
   
  ; This lines works
   .Col = 0
   .Row = 0
   .Text = 'Text1'
   .Col = 1
   .Row = 1
   .Text = 'Text1'
   
  ; This works also
   For $x = 0 To $oGrid.Cols - 1
      For $y = 0 To $oGrid.Rows - 1
         .Row = $x
         .Col = $y
         .Text = "x\"
         ConsoleWrite('@@ Debug(30) : .TextMatrix($x, $Y) = ' & .TextMatrix ($x, $y) & @LF & '>Error code: ' & @error & @LF);### Debug Console
      Next
   Next
EndWith

While 1
   $Msg = GUIGetMsg()
   Switch $Msg
      Case $GUI_EVENT_CLOSE
         ExitLoop
   EndSwitch
WEnd

Exit


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Yeah Gary, the reading works but not the writing with TextMatrix.

TextMatrix you can use to fill out a cell without changing the current(focus) cell...

I knew what you were trying to do, but both that one and the TextArray don't seem to be working


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0