Page 1 of 1
ButtonBar on Dialogs: FWH 15.04
Posted: Tue Apr 07, 2015 3:52 pm
by nageswaragunupudi
Till now we had to define buttonbar on a dialog and bar buttons in a separate function called from ON INIT clause while activating the dialog.
Now it is possible to define the buttonbar and buttons in the same procedure/function creating the dialog, same way as in the case of a window.
\fwh\samples\barondlg.prg
Code: Select all
#include "fivewin.ch"
REQUEST DBFCDX
function TestDlgBar
local oDlg, oBar, oFont, oSegoe, oBrw
FWNumFormat( "A", .t. )
USE CUSTOMER NEW SHARED VIA "DBFCDX"
DEFINE FONT oFont NAME "ARIAL" SIZE 0,-12 BOLD
DEFINE FONT oSegoe NAME "Segoe UI" SIZE 0,-14
DEFINE DIALOG oDlg SIZE 700,400 PIXEL TRUEPIXEL FONT oFont ;
TITLE "ButtonBar on Dialogs : FWH15.04"
DEFINE BUTTONBAR oBar OF oDlg SIZE 64,80 2007
DEFINE BUTTON OF oBar PROMPT "Add" FILE "c:\fwh\bitmaps\32x32\new.bmp" ACTION oBrw:EditSource( .t. )
DEFINE BUTTON OF oBar PROMPT "Edit" FILE "c:\fwh\bitmaps\32x32\edit.bmp" ACTION oBrw:EditSource()
DEFINE BUTTON OF oBar PROMPT "Delete" FILE "c:\fwh\bitmaps\delete.bmp" ACTION oBrw:Delete()
DEFINE BUTTON OF oBar PROMPT "Print" FILE "c:\fwh\bitmaps\print32.bmp" GROUP ACTION oBrw:Report()
DEFINE BUTTON OF oBar PROMPT "Excel" FILE "c:\fwh\bitmaps\excel.bmp" ACTION oBrw:ToExcel()
DEFINE BUTTON OF oBar PROMPT "PDF" FILE "c:\fwh\bitmaps\pdf.bmp" ACTION oBrw:Report( nil, .t., nil, nil, nil, "pdf" )
DEFINE BUTTON OF oBar PROMPT "Quit" FILE "c:\fwh\bitmaps\32x32\exit.bmp" GROUP ACTION oDlg:End()
@ 0,0 XBROWSE oBrw OF oDlg DATASOURCE Alias() ;
COLUMNS "First", "City", "State", "Age", "Salary" ;
FONT oSegoe ;
FOOTERS NOBORDER CELL LINES
oBrw:CreateFromCode()
oDlg:oClient := oBrw
ACTIVATE DIALOG oDlg CENTERED ON INIT oDlg:Resize()
RELEASE FONT oFont, oSegoe
CLOSE CUSTOMER
return nil
Re: ButtonBar on Dialogs: FWH 15.04
Posted: Tue Apr 07, 2015 5:31 pm
by nageswaragunupudi
Creating buttonbar from resource.
Code: Select all
#include "fivewin.ch"
function main()
local oDlg, oBar, oFont, oBrw
USE STATES
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE DIALOG oDlg RESOURCE "timbar" TITLE "FWH 15.04 BUTTONBAR FROM RESOURCE" FONT oFont
REDEFINE BUTTONBAR oBar ID 100 OF oDlg SIZE 64,60 2007
DEFINE BUTTON OF oBar PROMPT "Add" FILE "c:\fwh\bitmaps\32x32\new.bmp"
DEFINE BUTTON OF oBar PROMPT "Edit" FILE "c:\fwh\bitmaps\32x32\edit.bmp"
DEFINE BUTTON OF oBar PROMPT "Delete" FILE "c:\fwh\bitmaps\delete.bmp"
DEFINE BUTTON OF oBar PROMPT "Print" FILE "c:\fwh\bitmaps\print32.bmp" GROUP
DEFINE BUTTON OF oBar PROMPT "Quit" FILE "c:\fwh\bitmaps\32x32\exit.bmp" GROUP ACTION oDlg:End()
REDEFINE XBROWSE oBrw ID 101 OF oDlg DATASOURCE Alias() AUTOCOLS FOOTERS
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
return nil
Resource File:
Code: Select all
#include <windows.h>
timbar DIALOG 0, 0, 400, 200
STYLE DS_MODALFRAME | WS_BORDER | WS_DLGFRAME | WS_POPUP | WS_SYSMENU
FONT 8, "MS Sans Serif"
CAPTION "Test"
BEGIN
CONTROL "", 100, "TBar", 0 | WS_CHILD | WS_VISIBLE, 0, 0, 400, 40
DEFPUSHBUTTON "OK", IDOK, 40, 168, 50, 14, WS_VISIBLE
PUSHBUTTON "Cancel", IDCANCEL, 101, 168, 50, 14, WS_VISIBLE
CONTROL "", 101, "TXBrowse", 0 | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 50, 360, 100
END
Re: ButtonBar on Dialogs: FWH 15.04
Posted: Tue Apr 07, 2015 5:35 pm
by Antonio Linares
Great job dear Rao!
Re: ButtonBar on Dialogs: FWH 15.04
Posted: Tue Apr 07, 2015 8:34 pm
by James Bott
This is a great new feature, Rao. Thanks!
James
Re: ButtonBar on Dialogs: FWH 15.04
Posted: Tue Apr 07, 2015 9:42 pm
by TimStone
I will be using this when .04 is released. Thank you.
Re: ButtonBar on Dialogs: FWH 15.04
Posted: Wed Apr 08, 2015 4:27 am
by bpd2000
Antonio Linares wrote:Great job dear Rao!
+1
Re: ButtonBar on Dialogs: FWH 15.04
Posted: Tue Sep 22, 2015 9:41 am
by Joaoalpande
Good Morning,
how to make a combobox in buttonbar a dialog?
Thank´s
João Alpande
Re: ButtonBar on Dialogs: FWH 15.04
Posted: Tue Sep 22, 2015 3:50 pm
by karinha
Mira este ejemplo by Silvio Falconi...
http://forums.fivetechsupport.com/viewt ... og#p177735
Code: Select all
#include "fivewin.ch"
#include "xBrowse.ch"
#define LIGHTCYAN nRGB( 203, 225, 252 )
REQUEST DBFCDX
REQUEST DBFFPT
EXTERNAL ORDKEYNO,ORDKEYCOUNT,ORDCREATE,ORDKEYGOTO
static oTitle
static aFlds,aHdrs,nWild
function Main()
local oDlg, oGrid, oFont
local nOrder:= 1
local nRecno:= 1
RddSetDefault( "DBFCDX" )
SetHandleCount( 100 )
USE CUSTOMER ALIAS CL
INDEX ON CL->FIRST TAG FIRST TO CUSTOMER
DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -12
nWild := 2
aBrowse := { { { || CL->FIRST}, i18n("Cognome"), 150 },;
{ { || CL->LAST }, i18n("Nome"), 100 },;
{ { || CL->STREET }, i18n("Indirizzo"), 190 },;
{ { || CL->STATE}, i18n("Stato"), 145 } }
DEFINE DIALOG oDlg SIZE 640,440 PIXEL ;
FONT oFont TITLE 'Test '
oGrid := TXBrowse():New( oDlg )
oGrid:nTop := 30
oGrid:nLeft := 2
oGrid:nBottom := 200
oGrid:nRight := 320
FOR i := 1 TO Len(aBrowse)
oCol := oGrid:AddCol()
oCol:bStrData := aBrowse[ i, 1 ]
oCol:cHeader := aBrowse[ i, 2 ]
oCol:nWidth := aBrowse[ i, 3 ]
NEXT
oGrid:lIncrFilter := .t.
oGrid:lSeekWild := ( nWild == 2 )
oGrid:cFilterFld := "FIRST"
oGrid:SetRDD()
oGrid:CreateFromCode()
CL->(DbSetOrder(nOrder))
if nRecNo < CL->(LastRec()) .AND. nRecno != 0
CL->(DbGoTo(nRecno))
else
CL->(DbGoTop())
endif
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT( Create_bar(oDlg), Cerca_cliente(oTitle,"CL",oGrid, oDlg) )
return nil
//----------------------------------------------------------------------------------------//
Function Create_bar(oDlg)
DEFINE BUTTONBAR oTitle _3D SIZE 44, 46 OF oDlg 2007 NOBORDER
return nil
//----------------------------------------------------------------------------------------//
Function Cerca_cliente(oTitle,cdbf,oGrid, oDlg)
Local nLen := Len( oGrid:aCols )
Local n
Local oCbx
Local cCampo := oGrid:cFilterFld
nWild := 2
cList := "FIRST,LAST,STREET,STATE"
aFlds := HB_ATokens( cList, ',' )
aHdrs := { i18n("Cognome") ,;
i18n("Nome") ,;
i18n("Indirizzo") ,;
i18n("Stato") }
@ 6.9, 10 COMBOBOX oCbx VAR cCampo ;
ITEMS aHdrs ;
ON CHANGE (oGrid:cFilterFld :=aFlds[ocbx:nat], oGrid:Seek( "" ), oGrid:SetFocus() ) ;
SIZE 150,400 PIXEL OF oTitle
@ 6.9, 190 COMBOBOX nWild ITEMS { "Voci che iniziano con..", "Voci che contengono...." } ;
ON CHANGE ( oGrid:lSeekWild := ( nWild == 2 ), ;
oGrid:Seek( If( oGrid:lSeekWild, oGrid:cSeek, "" ) ), ;
oGrid:SetFocus() ) ;
SIZE 150,400 PIXEL OF oTitle
@ 6.9,340 say oGrid:oSeek PROMPT oGrid:cSeek SIZE 180,20 PIXEL ;
OF oTitle COLOR CLR_BLACK,CLR_WHITE PICTURE '@!' BORDER
DEFINE BUTTON OF oTitle FILENAME "..\bitmaps\16x16\Exit.bmp" FLAT ;
ACTION oDlg:End() TOOLTIP "Exit this app" GROUP
return nil
Re: ButtonBar on Dialogs: FWH 15.04
Posted: Tue Sep 22, 2015 4:10 pm
by Joaoalpande
Karinha, necesito usando recurso .rc
Gracias
Re: ButtonBar on Dialogs: FWH 15.04 - RESOLVED
Posted: Wed Sep 23, 2015 3:39 pm
by Joaoalpande
Code: Select all
FUNCTION CAW110()
LOCAL oItem:=oMOpc, oBtnB:=oBBar , oDlg, oWChld, nColP
LOCAL cVar,aIdx:={}, oIcon, cBmp, nW, nH ,oFntB ,OsAY,cmail
cBmp:=LoadBitMap(GetResources(),"C_Pal")
oT:=CA_110():New()
AFill(oT:oDat,NIL)
oDCli:=Open_Dbf("Clientes",.T.,.T.,aIdx)
(oDCli)->(OrdSetFocus(2))
(oDCli)->(DbGoTop())
cVar:=aIdx[2]
oAt:=1
oT:lObs:=IF(!Empty((oDCli)->Observ),.T.,.F.)
DEFINE ICON oIcon RESOURCE "IconSys"
DEFINE WINDOW oWChld MDIChild OF oWnd TITLE "Clientes" NOZOOM ICON oIcon
DEFINE DIALOG oDlg RESOURCE "CAW110" FONT oWnd:oFont OF oWChld
REDEFINE LISTBOX oBCli ;
FIELDS (oDCli)->RazSoc, Ds_Mar(cBmp), (oDCli)->NumCli,;
CF((oDCli)->UltVen), Desp_Imp() ;
HEADER "NOME/RAZÃO SOCIAL", "", "CÓDIGO", ;
"ULT. VENDA", "SDO. ATUAL" ;
SIZES 360, 15, 50, 90, 90 ;
ALIAS (oDCli)->(Alias()) ID 110 OF oDlg UPDATE FONT oWnd:oFont
oBCli:aJustify :={0,2,2,2,1}
oBCli:lCellStyle:=.F.
oBCli:nFreeze:=5
oBCli:nClrForeHead:=CLR_BLACK
oBCli:nHeaderHeight += 30
oBCli:nFooterHeight += 30
oBCli:nLineHeight:=15
oBCli:nClrBackHead:=CLR_LBLUE
oBCli:nClrFBack :=CLR_LBLUE
oBCli: nClrFFore :=CLR_WHITE
oBCli:bChange :={|| Refresca()}
oBCli:bLDblClick:={|| Desp_Men(oDlg,90,240)}
oBCli:bKeyDown :={|nKey| Val_nKey(nKey,oDlg)}
oBCli:bTextColor:={|nRow,nCol,nStyle| IF(nCol=5 .AND. nStyle=0 .AND. (oDCli)->SalAct<0,CLR_RED,)}
REDEFINE SAY oT:oDat[ 1] PROMPT (oDCli)->EncCom ID 111 OF oDlg COLOR CLR_BLUE
REDEFINE SAY oT:oDat[ 2] PROMPT (oDCli)->TelFi1 ID 112 OF oDlg COLOR CLR_BLUE
REDEFINE SAY oT:oDat[ 3] PROMPT (oDCli)->TelFi2 ID 113 OF oDlg COLOR CLR_BLUE
REDEFINE SAY oT:oDat[ 4] PROMPT (oDCli)->Mor1Fis ID 114 OF oDlg COLOR CLR_BLUE
REDEFINE SAY oT:oDat[ 5] PROMPT (oDCli)->Mor2Fis ID 115 OF oDlg COLOR CLR_BLUE
REDEFINE SAY oT:oDat[ 6] PROMPT (oDCli)->CodFis ID 116 OF oDlg COLOR CLR_BLUE
REDEFINE SAY oT:oDat[ 7] PROMPT (oDCli)->NIC ID 117 OF oDlg COLOR CLR_BLUE
REDEFINE SAY oT:oDat[ 8] PROMPT Desp_Cre() ID 118 OF oDlg COLOR CLR_BLUE
REDEFINE SAY oT:oDat[ 9] PROMPT (oDCli)->Email ID 119 OF oDlg COLOR CLR_BLUE
REDEFINE SAY oT:oDat[10] PROMPT (oDCli)->TelFi3 ID 120 OF oDlg COLOR CLR_BLUE
REDEFINE SAY oT:oDat[16] PROMPT (oDCli)->TelEn1 ID 125 OF oDlg COLOR CLR_BLUE
REDEFINE SAY oT:oDat[17] PROMPT (oDCli)->TelEn2 ID 126 OF oDlg COLOR CLR_BLUE
REDEFINE SAY oT:oDat[18] PROMPT (oDCli)->TelEn3 ID 127 OF oDlg COLOR CLR_BLUE
REDEFINE SAY oT:oDat[11] PROMPT (oDCli)->PriVen ID 121 OF oDlg COLOR CLR_BLUE
REDEFINE SAY oT:oDat[12] PROMPT Desp_Loc() ID 122 OF oDlg COLOR CLR_BLUE
REDEFINE CHECKBOX oT:oDat[13] VAR oT:lObs ID 123 OF oDlg
oT:oDat[13]:Disable()
REDEFINE SENSITIVE SAY PROMPT "» Observações «" ID 124 OF oDlg;
COLOR CLR_HRED COLOROVER CLR_HBLUE ;
ACTION Get_Observ() ;
ON MOUSEOVER SndPlaySound("Click.Wav") ;
RIGHT //TRANSPARENT
nW:=IF(IsWinNT(), 8, 8)
nH:=IF(IsWinNT(),28,27)
ACTIVATE DIALOG oDlg NOWAIT ;
VALID (oWChld:End(),.T.)
ACTIVATE WINDOW oWChld ;
ON INIT (oDlg:Move(0,0),Cria_bar(oDlg), Cria_B(aIdx,cVar)) ;
ON RESIZE (oWChld:SetSize(oDlg:nWidth+nW,oDlg:nHeight+nH)) ;
VALID (oWChld:=Nil,Cierra_Dlg(oItem,oBtnB),.T.)
RETURN (NIL)
//----------------------------------------------------------------------------------------//
Stat Function Cria_bar(oDlg)
IF cLook="2010"
DEFINE BUTTONBAR oBar _3D SIZE 65, 60 OF oDlg 2010 NOBORDER
ELSE
DEFINE BUTTONBAR oBar _3D SIZE 65, 60 OF oDlg 2007 NOBORDER
ENDIF
return nil
//----------------------------------------------------------------------------------------//
Stat Function Cria_b( aIdx,cVar)
LOCAL oCbx
DEFINE BUTTON OF oBar PROMPT "Novo" FILE ".\Bitmaps\sys\B_New.png" NOBORDER ;
TOOLTIP "Novo cliente" ACTION Ad_Dados(.T.)
DEFINE BUTTON OF oBar PROMPT "Apagar" FILE ".\Bitmaps\sys\B_Del.png" NOBORDER ;
TOOLTIP "Apagar Cliente" ACTION Del_Dados()
DEFINE BUTTON OF oBar PROMPT "Modificar" FILE ".\Bitmaps\sys\B_chg.png" NOBORDER ;
TOOLTIP "Modificar Dados" ACTION Ad_Dados(.F.)
DEFINE BUTTON OF oBar PROMPT "Preços" FILE ".\Bitmaps\sys\precos32.png" NOBORDER ;
TOOLTIP "Preços de Venda" ACTION Pre_Venda()
DEFINE BUTTON OF oBar PROMPT "C.Corrente" FILE ".\Bitmaps\sys\cntcor32.png" NOBORDER ;
TOOLTIP "Conta Corrente" ACTION Cnt_Corrente()
DEFINE BUTTON OF oBar PROMPT "Movimento" FILE ".\Bitmaps\sys\mov32.png" NOBORDER ;
TOOLTIP "Movimento" ACTION Movimento()
DEFINE BUTTON OF oBar PROMPT "Consigna." FILE ".\Bitmaps\sys\consig32.png" NOBORDER ;
TOOLTIP "Consignação" ACTION Pro_Cons(oDCli,oBCli,"5")
DEFINE BUTTON OF oBar PROMPT "Localizar" FILE ".\Bitmaps\sys\maps32.png" NOBORDER ;
TOOLTIP "Localizar no Google Maps" ACTION GOOGLE_MAPA_DIST()
DEFINE BUTTON OF oBar PROMPT "Imprimir" FILE ".\Bitmaps\sys\list4.png" NOBORDER ;
TOOLTIP "Imprimir" ACTION Relacao()
@ 20,600 COMBOBOX oCbx VAR cVar ;
ITEMS aIdx ;
ON CHANGE Sel_Index(oCbx);
SIZE 110,400 PIXEL OF oBar
oCbx:cTooltip:="Classificar..."
return nil
//----------------------------------------------------------------------------------------//
Thank´s
Re: ButtonBar on Dialogs: FWH 15.04
Posted: Fri May 22, 2020 6:04 pm
by lagm
bpd2000 wrote:Antonio Linares wrote:Great job dear Rao!
+1
+1
I join in thanking Mr. Dao.
Un problema que me demoré demasiadas horas en resolver.
Ya es segundo inconveniente que tengo con los controles creados como recursos en Pelles C.
Anteriormente, me falló el control xBrowse, y con la excelente ayuda de Adolfo Lagos pude solucionar.
Ahora tenía problemas con el control ButtonBar, y con el código de ejemplo de Mr. Rao, puedo seguir avanzando.
Lo que ocurre es que retomé la programación Harbour-FiveWin este 2020 luego de 5 años de inactividad.
Ahora me encuentro con herramientas más robustas pero que requieren bastante lectura para entender la forma de trabajar.
Terminé usando el editor de recursos Borland WorkShop, el cual tenía un excelente manual y una dll con los controles propios de Fivewin.
¿Eso ya no existe para Pelles C?
Si agrego el archivo .rc (generado con Pelles C), en el proyecto, me arroja varios errores
En cambio, si uso el archivo .res no tengo problemas, excepto los indicados anteriormente.
La consulta es:
¿Cuál es la mejor forma de trabajar los recursos, y qué extensión de archivo se debe incluir en el proyecto?
Luis Antonio GM
Curicó-Chile
Re: ButtonBar on Dialogs: FWH 15.04
Posted: Tue May 26, 2020 7:21 am
by jvtecheto
Hola amigo
Según mi experiencia del último año, si quieres trabajar con .RC, Resedit y con ficheros. res Puelles C.
En el Foro creo que la mayoría usa. RC, yo personalmente después de haberme peleado mucho con Resedit ahora no tengo ningún problema, prueba y su te da algún error postea, seguro que lo resolvemos
Saludos
José.
Enviado desde mi POCOPHONE F1 mediante Tapatalk