UNSOLVED How to get programmatically highlighted glyph in the space center



  • Hey,
    Is anyone able to help me? I'm trying to get programmatically two things in the CurrentSpaceCenter:

    1. input textbox object (more precisely, the cursor position in the object)
    2. highlighted glyph in the main space center viewScreenshot 2020-01-22 17.28.49.png

    Best,
    R


  • admin

    maybe you have to explain what you want to achieve...

    A space center object has getRaw which returns the input text as seen in the control and get which returns a list of glyph names, those are parsed from the input controls.



  • @gferreira said in How to get programmatically highlighted glyph in the space center:

    (don’t know how to get the cursor position)

    I think I will be able to figure it out. I will post it here when I will do it

    Thanks a lot again!



  • hello @RafaŁ-Buchner,

    1. input textbox object (more precisely, the cursor position in the object)

    the input text is available from the SpaceCenter object in different forms:

    from mojo.UI import CurrentSpaceCenter
    S = CurrentSpaceCenter()
    print(S.getRaw()) # returns the input string 
    print(S.get()) # returns a list of glyph names
    print(S.glyphRecords) # returns a list of GlyphRecords
    

    and here’s how you can get to the input field object:

    print(S.top.glyphLineInput)
    

    (don’t know how to get the cursor position)

    1. highlighted glyph in the main space center view
    print(S.glyphLineView.getSelected()) # returns the selected glyph as a glyph object
    

    cheers!

    ps. there’s also this:

    print(S.glyphLineView.getSelection()) # returns the index of the selected glyph