in reply to Re: How to make a Tk::Button move/slide within a Tk::Table
in thread How to make a Tk::Button move/slide within a Tk::Table

The idea is to have the button move while dragging and stay in that location when the button is released.
  • Comment on Re^2: How to make a Tk::Button move/slide within a Tk::Table

Replies are listed 'Best First'.
Re^3: How to make a Tk::Button move/slide within a Tk::Table
by kcott (Archbishop) on Feb 08, 2012 at 22:04 UTC

    My mental visualisation of what you're trying to achieve was clearly wrong. My apologies.

    You'll need to keep track of each cell the button is dragged through. When it enters a new cell, you'll need to blank out the last cell: probably easiest to use a Label without text, e.g. $table->put($r, $c, '').

    You also mentioned you wanted to move any existing button to a new cell ("... push the button under it to the right or to the next row ..."). I think you'll need to capture the return value of $table->put() to achieve this; although there's probably other ways of doing it.

    I hope that's a bit closer to what you're after.

    -- Ken

      I realized that I wasn't updating the row and col of $buttons$selectedButton in slideButton(). I added
      $buttons[$selectedButton]{'row'} = $mRow; $buttons[$selectedButton]{'col'} = $mCol;

      to slideButton() subroutine and now the blinking/left over widgets are gone...