lose focus on buttonbar
Posted: Thu Apr 27, 2023 9:22 am
i have a simple dialog with a buttonbar and 8 buttons
initially only the first 6 buttons are shown
if the user changes the buttonbar type it must show only two buttons
if the user restores the initial buttonbar he must put back the 6 buttons
when the buttonbar type changes it loses the focus and colors of the buttonbar
this is the test
initially only the first 6 buttons are shown
if the user changes the buttonbar type it must show only two buttons
if the user restores the initial buttonbar he must put back the 6 buttons
when the buttonbar type changes it loses the focus and colors of the buttonbar
this is the test
Code: Select all | Expand
#include 'fivewin.ch'
#include 'xbrowse.ch'
#include "constant.ch"
Function test()
local oDlg,oDbf,oFont
local oBar,aBtnBar:=array(8)
local nBottom := 27.2
local nRight := 89
local nWd := Max( nRight * DLG_CHARPIX_W, 180 )
local nHt := nBottom * DLG_CHARPIX_H
DEFINE DIALOG oDlg SIZE nWd, nHt PIXEL TRUEPIXEL;
TiTle "test"
@ 90,10 Button "Second bar" size 100,18 PIXEL OF oDlg action Btnbar(2,oBar,aBtnBar,oDlg)
@ 90,200 Button "First bar" size 100,18 PIXEL OF oDlg action Btnbar(1,oBar,aBtnBar,oDlg)
ACTIVATE DIALOG oDlg CENTER ;
ON INIT Btnbar(1,oBar,aBtnBar,oDlg)
RETURN NIL
//--------------------------------------------------------//
Function Btnbar(nBar,oBar,aBtnBar,oDlg)
DEFINE BUTTONBAR oBar OF oDlg SIZE 80,70 TOP NOBORDER 2015
Do case
case nbar =1
DEFINE BUTTON aBtnBar[1] OF oBar PROMPT "New"
DEFINE BUTTON aBtnBar[2] OF oBar PROMPT "Modify"
DEFINE BUTTON aBtnBar[3] OF oBar PROMPT "Duplicate"
DEFINE BUTTON aBtnBar[4] OF oBar PROMPT "Del"
DEFINE BUTTON aBtnBar[5] OF oBar PROMPT "Print"
DEFINE BUTTON aBtnBar[6] OF oBar PROMPT "Help"
DEFINE BUTTON aBtnBar[7] OF oBar PROMPT "Del"
DEFINE BUTTON aBtnBar[8] OF oBar PROMPT "Print"
aBtnBar[7]:hide()
aBtnBar[8]:hide()
case nbar = 2
aBtnBar[1]:hide()
aBtnBar[2]:hide()
aBtnBar[3]:hide()
aBtnBar[4]:hide()
aBtnBar[5]:hide()
aBtnBar[6]:hide()
DEFINE BUTTON aBtnBar[7] OF oBar PROMPT "Del" action msginfo()
DEFINE BUTTON aBtnBar[8] OF oBar PROMPT "Print" action msginfo()
aBtnBar[7]:show()
aBtnBar[8]:show()
endcase
return nil