Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20

Thread: How to get an indexed object in COM

  1. #11
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,153
    Rep Power
    736

    Re: How to get an indexed object in COM

    Hi Marcel,

    just tested the script in Word 2007 ( yes, that with ... unusual interface ) and all seems to work as it should.
    Good work !


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  2. #12

    Re: How to get an indexed object in COM

    Hi Marcel,

    I'm sorry for my typo (slipt instead of split)!
    I tested your script and now it work but I don't understand why SplitSpecial returns 0.
    If I made the call directly (I mean from the module) the results is the same, but strangely enough in both cases the function seems performed correctly.
    You can test it with:
    [code=thinbasic]

    msgbox 0, COM_Succeeded(COM_Execute(pWdView, "SplitSpecial", %TB_DISPATCH_PROPERTYGET, 0, 0, vRetVal))


    [/code]
    However, I'm working on setting an indexed property.

    Bye,
    Roberto
    http://www.thinbasic.com

  3. #13
    Member
    Join Date
    Oct 2007
    Location
    Enschede
    Age
    65
    Posts
    57
    Rep Power
    23

    Re: How to get an indexed object in COM

    Hi Roberto,

    Thanks for the testcode. I have the same problem as you with the SlitSpecial code. As I mentioned above the code I used was a recording done by Word. I created a macro to open the header. In the code the splitspecial property came along. But in all circumstances in Word it is always 0.

    I made another test and now I got another value for the SplitSpecial property when I first put the Word screen in the primary footer state.

    [code=vb]Sub header()
    'VBA code below
    '
    ActiveDocument.ActiveWindow.View.SplitSpecial = wdPanePrimaryFooter 'This command opens a special footer window
    If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
    ActiveWindow.Panes(2).Close
    End If
    If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
    ActivePane.View.Type = wdOutlineView Then
    ActiveWindow.ActivePane.View.Type = wdPrintView
    End If
    ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
    Selection.TypeText Text:="test"
    ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
    End Sub[/code]

    About the indexing problem, I got it wotking with the .Item property.
    Kind regards<br /><br />Marcel

  4. #14

    Re: How to get an indexed object in COM

    Hi Marcel,

    as far as I understand SplitSpecial property should gets or sets the active window pane, so may be in our case the active window pane is 0, so we should first try to set as active the window pane nr.1 but I must finish to accommodate the function.

    About the indexing problem, I got it wotking with the .Item property
    Did you mean set the .Item property or get or both?

    Ciao,
    Roberto
    http://www.thinbasic.com

  5. #15
    Member
    Join Date
    Oct 2007
    Location
    Enschede
    Age
    65
    Posts
    57
    Rep Power
    23

    Re: How to get an indexed object in COM

    Hi Roberto,

    About the SplitSpecial issue you are right. With all the information I gathered uptil now and tests I made, it was after all simple. The reason that the code wasn't invoked was due to fact that the SplitSpecial and wdPaneNone were still the same.

    [code=vb]If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
    ActiveWindow.Panes(2).Close
    End If[/code]

    When a user is working in Word the user can get the screen in a certain state, see the SplitSpecial types above in the answer for Abraxas. However, I could not get Word in this state only with VBA code, see next example vba code.

    [code=vb]'VBA Code
    ActiveDocument.ActiveWindow.View.SplitSpecial = wdPanePrimaryFooter 'This command opens a special footer window[/code]

    So this is a simple property setting and it works when I assign one of the wd-constants. In fact the problem is solved now.

    About the adddressing of the index. I tested a lot with different constructions and the next one works when I use the Item property in VBA. It is possible to use the short way of adressing:

    [code=vb]ActiveWindow.Panes(2).Close[/code]

    and the extended way with the Item property.

    [code=vb]temp = ActiveWindow.Panes.Item(2)
    temp.close[/code]

    and resulted in the next thinbasic code:

    [code=thinbasic]
    'thinBasic code
    'Now the addressing starts!
    vParam(1) = 2
    COM_Execute(pWdPanes, "Item", %TB_DISPATCH_METHOD, 1, vParam, vRetVal) 'This works

    'vRetVal holds the indexed pane value.

    pWdPane = vRetVal
    COM_Execute(pWdPane, "Close", %TB_DISPATCH_METHOD, 0, 0, 0)
    [/code]

    So in the end we can call just one object from a colection of objects. In this case it is a Pane but if there are more than one documents active we can get one particular document and make it active and work with it. The problem was which thinbasic syntax I had to use to 'connect' the object model. But you must tell me if what I made is correct, I have no knowledge about it, I just combining syntaxes and see what happens. ;D

    Now it can. That means also that constructions with [code=vb]for each obj in objects[/code] must be rewritten into loop constructions.

    ------ Added -------------

    To answer your question: Did you mean set the .Item property or get or both? >>>> BOTH
    Kind regards<br /><br />Marcel

  6. #16
    Member
    Join Date
    Oct 2007
    Location
    Enschede
    Age
    65
    Posts
    57
    Rep Power
    23

    Re: How to get an indexed object in COM

    Hi,

    How can I prevent those &#38;#160;&#38;#160 characters in the code boxes when I edit the text after I've posted it? >
    Kind regards<br /><br />Marcel

  7. #17
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,153
    Rep Power
    736

    Re: How to get an indexed object in COM

    Not sure what they are,

    try to "modify message", delete them and place there spaces (?)


    Bye,
    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  8. #18

    Re: How to get an indexed object in COM

    Marcel

    maybe you used the small edit icon on the right, try to use the Modify message link on the top of post.

    Ciao,
    Roberto
    http://www.thinbasic.com

  9. #19
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,817
    Rep Power
    10

    Re: How to get an indexed object in COM

    Sometimes I've noted too that color codes in colored syntax.
    Usually it is enough to re-edit the message and save again to see them disappear.
    Seems a problem of the syntax color engine. Sometimes it get confused by some code


    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  10. #20
    Member
    Join Date
    Oct 2007
    Location
    Enschede
    Age
    65
    Posts
    57
    Rep Power
    23

    Re: How to get an indexed object in COM

    @Petr: Yes replacing them works fine. I have done this all the time but now I want to prevent this.&#160;

    @Roberto: Yes, I used the little edit Icon. I'll try the modify message link.&#160;

    --- Ok, that works better.
    Kind regards<br /><br />Marcel

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Can TBGL Do multitexture for an M15 Object?
    By bookhead in forum TBGL General
    Replies: 3
    Last Post: 24-11-2009, 15:57
  2. class+object+dialog
    By Lionheart008 in forum UI (User Interface)
    Replies: 3
    Last Post: 17-11-2009, 22:09

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •