A sample code is given below for testing all the alternatives. For bitmaps any available bmp files may be used.
- Code: Select all Expand view
#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
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.