ButtonBar button with odragcursor problems
Posted: Wed Feb 06, 2008 5:05 pm
If a button in the buttonbar is also used to start drag operation by assigning a value to its data oDragCursor it is noticed that (1) the buttons bAction block is never executed, (2) mouse click on the button has no effect, (3) in case of 2007 style, when mouse is moved over the button, it is painted in orange color but even after mouse leaves the button the orange color stays till the end of the application (4) in case of non-2007 style the button is never hilighted when mouse is moved over the button. Only drag works.
A sample code is given below for testing all the alternatives. For bitmaps any available bmp files may be used.
Issues need to be fixed:
1. In 2007 style, the button should be painted active ( orange color ) only when mouse is over the button and the color to be restored to normal when mouse moves away from the button.
2. Non 2007 style: Button should be highlighted ( like other buttons ) when mouse is moved over the button.
3. When mouse is clicked on the button, (a) second bitmap should be painted (b) button should be painted as clicked like other buttons (c) bAction should be executed if drag does not start.
A sample code is given below for testing all the alternatives. For bitmaps any available bmp files may be used.
Code: Select all
#include 'fivewin.ch'
function Main()
local ownd,oBar
local oBtn1, oBtn2, oBtn3, oBtn4, oBtn5
DEFINE WINDOW oWnd
DEFINE BUTTONBAR oBar OF oWnd SIZE 64,64 3D // 2007
DEFINE BUTTON oBtn1 OF oBar FILE "UP.BMP","DOWN.BMP" TOP PROMPT "1" FLAT ACTION oWnd:Say( 10, 5, "Btn.1" )
DEFINE BUTTON oBtn2 OF oBar FILE "UP.BMP","DOWN.BMP" TOP PROMPT "2" FLAT ACTION oWnd:Say( 10, 5, "Btn.2" )
DEFINE BUTTON oBtn3 OF oBar FILE "UP.BMP","DOWN.BMP" TOP PROMPT "3" FLAT ACTION oWnd:Say( 10, 5, "Btn.3" )
DEFINE BUTTON oBtn4 OF oBar FILE "UP.BMP","DOWN.BMP" TOP PROMPT "4" FLAT ACTION oWnd:Say( 10, 5, "Btn.4" )
DEFINE BUTTON oBtn5 OF oBar FILE "UP.BMP","DOWN.BMP" TOP PROMPT "Q" FLAT ACTION oWnd:End()
oBtn3:oDragCursor := TCursor():New(,'DRAG')
oBtn3:bDragBegin := { |r,c,f| nil }
oWnd:bDropOver := { |u,r,c,f| MsgInfo("Dropped") }
ACTIVATE WINDOW oWnd
return nil
1. In 2007 style, the button should be painted active ( orange color ) only when mouse is over the button and the color to be restored to normal when mouse moves away from the button.
2. Non 2007 style: Button should be highlighted ( like other buttons ) when mouse is moved over the button.
3. When mouse is clicked on the button, (a) second bitmap should be painted (b) button should be painted as clicked like other buttons (c) bAction should be executed if drag does not start.