I understand that you don't understand,
when I show the two buttons I have to put them in first and second place not at the bottom of the buttobar
I want to do it this way for a logical question, if I select a record (or more records) I can delete it or print it, so I don't need the new, edit, duplicate buttons.
entiendo que tu no entiendas,
cuando muestro los dos botones tengo que ponerlos en primer y segundo lugar no en la parte inferior de la barra de botones
Quiero hacerlo de esta manera por una pregunta lógica, si selecciono un registro (o más registros) puedo eliminarlo o imprimirlo, por lo que no necesito los botones nuevo, editar, duplicar.
Please compile it before and you can see what I mean
- Code: Select all Expand view RUN
#include 'fivewin.ch'
#include 'xbrowse.ch'
#include "constant.ch"
function Main()
RddSetDefault( "DBFCDX" )
SetHandleCount( 100 )
FWNumFormat( "E", .t. )
SET DATE FORMAT "dd-mm-yyyy"
SET DELETED ON
SET CENTURY ON
SET EPOCH TO year( date() ) - 20
SET MULTIPLE OFF
SetGetColorFocus(RGB(255,255,224))
SetMGetColorFocus(rgb(255,255,224))
test()
RETURN NIL
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
oDbf :=TDatabase():Open( , "Customer", "DBFCDX", .T. )
oDbf:setorder(1)
oDbf:Gotop()
DEFINE DIALOG oDlg SIZE nWd, nHt PIXEL TRUEPIXEL;
TiTle "test"
@ 90,10 Button "Select one" size 100,18 PIXEL OF oDlg action (oBrw:SelectRow( 2 ),Btnbar(2,oBar,aBtnBar,oDlg))
@ 90,200 Button "DeSelect one" size 100,18 PIXEL OF oDlg action (oBrw:SelectRow( 0 ),Btnbar(1,oBar,aBtnBar,oDlg))
@ 110,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
DATASOURCE oDbf AUTOCOLS ;
AUTOSORT FONT oFont;
NOBORDER CELL LINES
WITH OBJECT oBrw
:SetMultiSelectCol()
:CreateFromCode()
END
ACTIVATE DIALOG oDlg CENTER ;
ON INIT Btnbar(1,oBar,aBtnBar,oDlg)
RETURN NIL
//--------------------------------------------------------//
Function Btnbar(nBar,oBar,aBtnBar,oDlg)
local aGrad:= { | lPressed | If( ! lPressed,;
{ { 1, RGB( 250,250,245), RGB( 250,250,245)} },;
{ { 1, RGB( 245,245,235), RGB( 245,245,235)} } ) }
DEFINE BUTTONBAR oBar OF oDlg SIZE 80,70 TOP NOBORDER 2015
Do case
case nbar =1
DEFINE BUTTON aBtnBar[1] OF oBar PROMPT "New" action nil
DEFINE BUTTON aBtnBar[2] OF oBar PROMPT "Modify" action nil
DEFINE BUTTON aBtnBar[3] OF oBar PROMPT "Duplicate" action nil
DEFINE BUTTON aBtnBar[4] OF oBar PROMPT "Del" action nil
DEFINE BUTTON aBtnBar[5] OF oBar PROMPT "Print" action oBrw:report()
DEFINE BUTTON aBtnBar[6] OF oBar PROMPT "Help" action nil BTNRIGHT
* DEFINE BUTTON aBtnBar[7] OF oBar PROMPT "Del" action nil
* DEFINE BUTTON aBtnBar[8] OF oBar PROMPT "Print" action oBrw:report()
* aBtnBar[7]:hide()
* aBtnBar[8]:hide()
case nbar = 2
aBtnBar[1]:hide()
aBtnBar[2]:hide()
aBtnBar[3]:hide()
aBtnBar[4]:hide()
aBtnBar[5]:hide()
DEFINE BUTTON aBtnBar[7] OF oBar PROMPT "Del" action nil
DEFINE BUTTON aBtnBar[8] OF oBar PROMPT "Print" action oBrw:report()
DEFINE BUTTON aBtnBar[6] OF oBar PROMPT "Help" action nil BTNRIGHT
endcase
WITH OBJECT oBar
oBar:bClrGrad := aGrad
oBar:bRClicked := { || NIL }
oBar:bLClicked := { || NIL }
oBar:Adjust()
END
ChangeButtons( oBar )
AEval( oBar:aControls, { | oCtrl | oCtrl:refresh() } )
return nil
function ChangeButtons( oBar )
AEval( oBar:aControls, { | oCtrl | oCtrl:nTop += 4, oCtrl:nHeight -= 4 } )
return .T.
why I cannot press the buttons ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com