[SOLVED] PyGTK: select a line in a textbuffer on mouse clic

Hello!
I am working on a dictionary using CEDICT in pyhton+GTK and on the GUI I have a textbuffer which I use to display some candidates after a word is looked up and I would like to let the user to clic a candidate to display the corresponding translation. Therefore I want to get the whole line of the text buffer on which the mouse has clicked (in order to highlight it to let the user know it and to get the corresponding string to display the right translation).
But I haven't found out how to deal with that so I just hope someone can help me.
By the way the textbuffer is set as not editable and the cursor isn't visible. I thought I could use the position of the cursor to select the current line in which the cursor is but I don't really know how to do so...
I would be very happy if someone could give me a hand
Last edited by jiehong (2011-05-01 09:00:07)

Ok, I've found out that it would be more suitable to use a ListStore which is more designed for that… so, let's say SOLVED…

Similar Messages

  • Selection of line item

    hi,
    Hi,
    i want to select the lines in table control of transaction va02 and then want to delete that line through a program for selection, but how can i know that this line is selected and then proceed further.
    regards
    m.phanindra

    Hi
       I may not give you the exact answer, but i think this will give you an idea in solving your issue.
       1) When we select some line from the list, then 'AT LINE-SELECTION' event will get triggered... You can write the required coding in this block of the code.
       2) Inorder know which line is selected, we use the HIDE area for that.
       ex: HIDE: wa_spfli-carrid,
                      wa_spfli-connid.
        This HIDE will store all the field values which come through it, and When a row is selected the data that has been hidden for that particular row will be made available again in the AT LINE-SELECTION block.
       Hope this will help you.
    Thanks
    Ravi

  • How to select multiple lines in ALV report

    hi gurus,
    I am working on an interactive ALV report where i have to select multiple lines from the basic list into an internal table, based on check box clicks. Using RS_SELFIELD i can select only 1 row. The coding has been done based on Call Function. Can u please suggest some way.
    Regards,
    Satyajit

    hi,
    try like this
    TABLES:     ekko.
    TYPE-POOLS: slis.                                 "ALV Declarations
    TYPES: BEGIN OF t_ekko,
      sel,                         "stores which row user has selected
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      statu TYPE ekpo-statu,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
      menge TYPE ekpo-menge,
      meins TYPE ekpo-meins,
      netpr TYPE ekpo-netpr,
      peinh TYPE ekpo-peinh,
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
          fieldcatalog1 TYPE slis_t_fieldcat_alv WITH HEADER LINE,
          gd_tab_group TYPE slis_t_sp_group_alv,
          gd_layout    TYPE slis_layout_alv,
          gd_repid     LIKE sy-repid.
    DATA : BEGIN OF det_tab OCCURS 0,
            ebeln LIKE ekpo-ebeln,
           END OF det_tab.
    START-OF-SELECTION.
      PERFORM data_retrieval.
      PERFORM build_fieldcatalog.
      PERFORM build_layout.
      PERFORM display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
    *       Build Fieldcatalog for ALV Report
    FORM build_fieldcatalog.
      fieldcatalog-fieldname   = 'EBELN'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'EBELP'.
      fieldcatalog-seltext_m   = 'PO Item'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'STATU'.
      fieldcatalog-seltext_m   = 'Status'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'AEDAT'.
      fieldcatalog-seltext_m   = 'Item change date'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'Material Number'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'MENGE'.
      fieldcatalog-seltext_m   = 'PO quantity'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'MEINS'.
      fieldcatalog-seltext_m   = 'Order Unit'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'NETPR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-do_sum      = 'X'.        "Display column total
      fieldcatalog-datatype     = 'CURR'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'PEINH'.
      fieldcatalog-seltext_m   = 'Price Unit'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
    *       Build layout for ALV grid report
    FORM build_layout.
      gd_layout-box_fieldname     = 'SEL'.
      "set field name to store row selection
      gd_layout-edit              = 'X'. "makes whole ALV table editable
      gd_layout-zebra             = 'X'.
    ENDFORM.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
    *       Display report using ALV grid
    FORM display_alv_report.
      gd_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program       = gd_repid
          i_callback_user_command  = 'USER_COMMAND'
          i_callback_pf_status_set = 'SET_STAT'
          is_layout                = gd_layout
          it_fieldcat              = fieldcatalog[]
          i_save                   = 'X'
        TABLES
          t_outtab                 = it_ekko
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
    *       Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
      SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
       UP TO 10 ROWS
        FROM ekpo
        INTO CORRESPONDING FIELDS OF TABLE it_ekko.
    ENDFORM.                    " DATA_RETRIEVAL
    *       FORM USER_COMMAND                                          *
    *       --> R_UCOMM                                                *
    *       --> RS_SELFIELD                                            *
    FORM user_command USING r_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
    * Check function code
      CASE r_ucomm.
        WHEN '&IC1'.
          IF rs_selfield-fieldname = 'EBELN'.
            READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
            SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
            CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
          ENDIF.
        WHEN 'DET'.  "button add by me
          CLEAR det_tab.
          REFRESH det_tab.
          LOOP AT it_ekko INTO wa_ekko WHERE sel = 'X'.
            MOVE-CORRESPONDING wa_ekko TO det_tab.
            APPEND det_tab.
          ENDLOOP.
          PERFORM build_cat.
          PERFORM dis_data.
      ENDCASE.
    ENDFORM.                    "user_command
    *&      Form  set_stat
    *       text
    *      -->RT_EXTAB   text
    FORM set_stat USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'ZSTAT' EXCLUDING rt_extab.
    ENDFORM.                    "set_stat
    *&      Form  build_cat
    *       text
    FORM build_cat.
      CLEAR fieldcatalog1.
      REFRESH fieldcatalog1.
      fieldcatalog1-fieldname = 'EBELN'.
      fieldcatalog1-tabname = 'DET_TAB'.
      fieldcatalog1-seltext_m = 'Order No.'.
      fieldcatalog1-outputlen = 10.
      APPEND fieldcatalog1 TO fieldcatalog1.
      CLEAR fieldcatalog1.
    ENDFORM.                    "build_cat
    *&      Form  dis_data
    *       text
    FORM dis_data.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program = 'ZTEST_DS'
          it_fieldcat        = fieldcatalog1[]
          i_save             = 'X'
        TABLES
          t_outtab           = det_tab.
    ENDFORM.                    "dis_data
    here i have copied standard gui status of ALV into my z status ZSTAT and add one button DET......
    here u can select morethan one line using control(ctrl)
    reward if usefull...

  • Creating and Selecting a line in After Effects CC?

    OK, So I suppose this is a two part question...
    But there is a little thing in After Effects CC that is annopying me alot, and it could just be me, and the way I've been doing things...
    1) The way I have creating a simple Line in After effects, is by using the pen tool, placing two points, and then just using a stroke on the Shape Layer, and no fill. Is this the most efficient way to creating a line in After Effects? It's what i have always done, and it's not until CC that it has been a pain.
    2) The reason why it's inconveniencing me is when i try to select that Shape Layer in the Comp Viewer! For some reason, in CS6, when i wanted to select that line, i could just click on it, and it selects the layer, Now, when i click on the line i just made, nothing happens, no where in the line that i can click or highlight will it select the layer of that line, Instead, I have to click the very center of the composition for some reason. there is small unseen point there that i either have to click exactly, or click and drag in that area, in order to select the layer, which gets annoying if there are many line at any given moment. This point is also where the anchor point for the layer is placed.... Is there any way to change this? To be able to change some setting so that when i click on the line itself, it selects it, and to have the Anchor point be placed in the center of the two point i make?

    But I do this kind of thing all the time. The last 5 projects involved 8 stroked horizontal and vertical shape layers drawn with the path tool that I had to move around the screen. I also had a bunch of little shapes that were only 5 X 5 pixels. These layers are nearly impossible to grab in the comp window at even 200% zoom factor without inadvertently grabbing the wrong layer or scaling the layer when you try to move it in the comp window.
    It is like trying to drive a screw with a hammer. It will kind of work but you will do a much better job if you use a screwdriver and the screw will remain undamaged. Hence, selecting small assets in the timeline and moving them around with the transform properties from the timeline is using a screwdriver. Using the direct selection tool is just the wrong tool for this and it always has been. You have to have some real estate to grab on to if you expect to move a layer without scaling it.
    You can mitigate the scaling problem for small layers by adding a simple expression to scale so the layer always stays at 100% but this will just automatically fix the scale problem and won't help moving the layer around in the comp window very much.

  • Error in TCode iview Select a line or position the Cursor correctly

    Hi All,
    I am getting the below error while selecting the row in Tcode iview
    Select a line or position the Cursor correctly.
    You have not selected a delivery or a delivery item for processing and the cursor is not positioned on a valid line, even after i am
    selecting the Delivery and click on the execute button
    My system config  :
    NW04s SP 20
    Thanks&Regards
    Murthy

    Hi Murthy,
    Create the Iview again.Hope the issue will resolve.
    Thanks,
    Arun

  • How do I select a line in preview

    I open an image in Preview and select Annotate. I can add text to the image, and a line/arrow. But once the line is created, I can't select it.

    Go back to the line mode and move the cursor over the line until it turns
    from this to this
    Click once to select the line:
    OT

  • How to select multiple lines in reports

    Hi,
    how to select multiple lines in a reports and process those selected lines to other activities like BDC.
    Please paste sample report here. or any demo examples . (don't paste ALV report , paste only classical report)
    suppose there are 10 records in output, i want to select 3 records and process other activities like bdc.
    Point will awarded.

    Hi ,
    the o/p in ur case will be a basic list output with a check box enabled in the left .
    Now say there are 10 records in the list output and i have checked 3 of them where checkboxes are enabled .
    And i press a button to submit this to the BDC .
    Here u need to make use of
    READ LINE statement to read the records from the list output and then pass them to the BDC .
    The code would be something like this
    DO .
    Read line index <field> where checkbox <> ' '.
    ENDO.
    You can have a look at the F1 help on read line . This will mkae u clear .
    Hope this gives u an idea.
    Regards,
    Vijay.

  • Selecting multiple lines in a sales order

    Hello documentation says we should be able to select multiple lines in a sales order (for example to cancel them or remove them). Yet we cannot select more than one. Shift and Ctrl do not seem to work.
    Any idea why this does not work ? We are running B1 2007A, patch 37.
    Thanks a lot
    Fabrice

    Hi Fabrice,
    if you have a sales order with hundreds of rows, use the 'Draw Document Wizard -> Customise' option to draw the required rows into the target document. Once all row data has been copied to the target, the row is greyed out in the sales order & can no longer be drawn. As long as the BP accepts partial deliveries, you may copy as much partial data to multiple target documents as necessary. Once you are finished with the sales order & there are rows still open, you may go to Data -> Close & hence close the entire document. There will be no need to delete the remaining rows.
    All the best,
    Kerstin

  • Select multiple lines in a sorted subsumarized ALV

    Select multiple lines in a sorted sub summarized ALV
    Hi all,
    I had to make  a Z version of ME28 transaction in order to do a PO mass release.
    The customer asked for a similar looking transaction.
    The ALV displays PO sorted and summarized by Purchase Document.
    I had a selection column to the ALV so the user can select multiple PO.
    Te problem is that I don’t know how to see wich PO’s are selected due the selection field of my output data does not get marked when I click on the Purchase Document
    As you an see in the ALV I created you can select at "header level" by clicking on the Purchasing Order row.
    But this does not affect my output table so I dont have an X on the select field.
    It does when I click on a item level.
    How can I read this marked lines?
    Thanks in advance.

    I need to release it.
    It works fine when I select an item row, cause it updates the i_output-sel = X, So I just loop it and do the mass release,
    Problem is when I try to do a seletion like in the image I've upload.
    I need to know wich line of my i_output table correspond to which subtotal Purchasing Order selectedrow.

  • Itunes - how do i select multiple line items not in sequence ?

    itunes - how do i select multiple line items not in sequence ?

    Hold down the Command key and click each in succession.
    To extend the selection across items that ARE contiguous, use the Shift key.

  • Select every lines of a tabe in one time, with Visual Composer

    Hi experts,
    I am using Visual Composer, but I meet some issues. Does any one know how to select every lines of a tables in a same time? do I need a buitton for this?
    thank you for your reply
    regards,
    Pierre

    hi Jhansi,
    thank you very much for your response.
    nevertheless, this is not what I wanted to do (perhaps I should explain better).
    In fact, what I want is is to do as if I clicked on every single line of my table, but in one time (without cliking on them one by one...)
    I do not want to short them with color, I reall want to select every one of them, but in one time.
    thanks a lot
    regards,
    pierre

  • How to select valid lines in a secondary list in a interactive report

    hi
    how to select valid lines in a secondary list in a interactive report

    hi,
    do this one
    at line-selection.
    if sy-lsind = some list no.
    GET CURSOR FIELD FIELDNAME VALUE FIELDVALUE.
            IF FIELDNAME = 'TVBAK-VBELN'.
    do some thing
    Regards
    ASHOK KUMAR

  • MIRO Deselect and select Multiple line items

    Hi All,
    At the time of miro we are taking the reference of PO. In PO we have 1200 lines related to Custom duty, additional custom duty, ecess, clearing and forwarding charges and freight.
    we want to do the MIRO for custom duty, additional duty and freight only, for these we have 600 line items. we need to select these lines one by one. this is time taking job.
    can any body tell me that how we can select these line at once.
    Regards all

    Hi,
    You can make use of Planned Delivery cost in the PO Refernce Tab. This will cover all other costs other than you basic material or service cost.
    Regards,
    amit

  • Select single line in ALV with FM REUSE_ALV_GRID_DISPLAY

    Hi!
    How can i set for select just a single line in ALV? I´m using FM REUSE_ALV_GRID_DISPLAY and in layout structure doesn´t has field SEL_MODE for set.
    In my ALV, in left site of colum names has a buttom for select all lines. I would like to hide this buttom. I removed this buttom from toolbar but it appear in left side of colum names yet.
    Anybody can help me?

    I do that but buttom just disappear from toolbar. It still appear in left side of colum name.
    My code:
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program       = sy-repid
          i_callback_user_command  = 'ALV_USER_COMMAND'
          i_callback_pf_status_set = 'F_SET_PF_STATUS'
          is_layout                = gs_layout
          it_fieldcat              = gw_fieldcat
        TABLES
          t_outtab                 = gw_relat
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
    FORM f_set_pf_status USING t_kkblo_t_extab.
      DATA: lw_fcode TYPE TABLE OF sy-ucomm.
      APPEND '&ALL' TO lw_fcode.
      APPEND '&SAL' TO lw_fcode.
      SET PF-STATUS 'ALV_STATUS_GUI' EXCLUDING lw_fcode.
    ENDFORM.                    "F_SET_PF_STATUS

  • Selection -- Converting lines to paragraphs

    In Homesite you are able to take a selection of lines and
    convert those lines to a list. I would like to do the same thing
    only convert the lines to individual paragraphs.
    Does anyone know if this is possible and how would I do it. I
    have hundreds of pages to setup in basic html and this would save
    me mega time!
    Thanks,
    Liz

    BTW  A wonderful collection of video tutorals for CC
    http://tv.adobe.com/show/learn-photoshop-cc/

Maybe you are looking for

  • Null offset from calibration not being applied to output

    I am measuring some load cells using a I 9237.  I am setting the null offset using Device > Bridge Calibration in the DAQ Assistant.  I measure the offet and hit calibrate.  It says "Calibration successful" and I hit finish, but the offset value is n

  • Vendor Payment Block in FI

    Hi all, We have a requirement to automatically block all vendor line items coming from electronic bank statement.  What is the best approach to do this?  Please note we are not entirely blocking all vendor line items, only the ones coming from electr

  • Use of JDBC Trace feature

    I want to see what SQL statements are executed against HANA when I run BObj Analysis for Excel on top of HANA views I had created. Accordingly to the HANA Development Guide p.63 it should be possible. Actually, I don't see my SQL statements in the lo

  • Modifying existing BO Server Installation

    I've found the following articale warning that any modification made to the base install of a server installation will require any subsequent service packs and patches to be reinstalled after modification. The article is filed under XI R2 and XI 3.1

  • Adding header in split alv using SALV

    Hello Champs, I have a requirement to display 6 diff reports in a screen. I have achieved it by using SALV(Split Container). Now I need to add header to each ALV report. The normal way of adding header in SALV doesnt work in the split ALV. Can someon