Jump to content

COM help needed


Recommended Posts

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
Link to comment
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

Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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

Link to comment
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.

 

Link to comment
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.

 

Link to comment
Share on other sites

  • 12 years later...
  • Moderators

@SravyaSuram did you happen to notice this thread is 13 years old?! Please don't resurrect old threads; the language has changed just a bit in the last decade. Start a new thread, and follow the suggestions below on how to ask decent questions:

 

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...