mouse-over events

Discussion in 'Rebol' started by pstrayeux, Apr 13, 2010.

  1. pstrayeux

    pstrayeux New Member

    How to avoid that mouse-over events become bound to the clicked buttons.
    Please advice. Peter

    - click any button (changes color on buttons with the same text)
    - click an other (same)
    - move the mouse over any colored button
    - the color change should not occur but I can't figure out why it does.

    rebol []

    reb-ver: rebol/version
    tst-ver: "2.7.7.3.1"



    set-button-color: func [face][

    color: to-tuple reduce [(80 + random 175) (80 + random 175)(130 + random 125)]

    foreach f face/parent-face/pane [
    if (f/text = face/text) [
    f/effect: [colorize color 128 extend 14]
    show f

    ]
    ]
    ]



    ; /////////////////
    make-square: does [

    buttons: copy [across space 0]

    loop 25 [
    repeat j 25 [
    repend buttons ['btn 22X22 to-string to-char (random 25) + 64
    [ set-button-color face ]
    ]
    ]
    repend buttons 'return
    ]
    append buttons compose [here: at at here + 0x50

    text join "Tested Rebol version: " tst-ver

    at here + 0x90
    text join "Actual Rebol version: " [
    reb-ver " Click two columns then move cursor to the first col and hover"]
    ]


    view layout/origin buttons 100x100

    ]

    make-square
  2. Graham

    Graham Developer Staff Member

    When you mouse over the squares you are doing a show on them ( on-over effect ), and this displays the new color. That all previously changed buttons only change to the new color suggests that you have a global color variable.

    This fixes it.
  3. pstrayeux

    pstrayeux New Member

    Thanks, Graham. To correct my misconception I moved the 'show f' outside the preceding if.

Share This Page