Page 1 of 2
Mr. Rao, refresh a Tree
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Wed Feb 07, 2024 7:06 pm
by Armando
Mr. Rao:
could you make a small example to make a Tree from an xBrowse for a fool like me,
allowing to modify a branch and refresh the browse? I have seen several answers
in the forum but none to refresh the browse
Just I have this code:
- Code: Select all Expand view
REDEFINE XBROWSE oBrw ID 200 OF oDlg;
DATASOURCE oRsTie;
COLUMNS "CLI_NOM","TIE_NOM","TIE_NUM";
HEADERS "Razón Social del Cliente","Nombre de la tienda","Número";
COLSIZES 250,200,50;
PICTURES Nil,Nil,"@Z 9999999";
JUSTIFY {AL_LEFT,AL_LEFT,AL_RIGHT};
FOOTERS AUTOSORT
WITH OBJECT oBrw
:l2007 := (.F.)
:lHScroll := (.F.)
:lVScroll := (.F.)
:nMarqueeStyle := MARQSTYLE_HIGHLROW
:nColDividerStyle := LINESTYLE_LIGHTGRAY
:nRowDividerStyle := LINESTYLE_LIGHTGRAY
:nStretchCol := STRETCHCOL_WIDEST
:nHeaderHeight := 25
:nRowHeight := 22
:nFooterHeight := 25
:bClrHeader := { || {CLR_WHITE,CLR_BLACK} }
:bClrFooter := { || {CLR_WHITE,CLR_BLACK} }
:bClrSel := { || IF( oBrw:KeyNo % oApp:nRowsInt == 0 ,{ CLR_BLACK, oApp:nRowParClr },{ CLR_BLACK, oApp:nRowNonClr }) }
:bClrSelFocus := { || {oApp:nFClrFocus,oApp:nBClrFocus} }
:bClrStd := { || IF( oBrw:KeyNo % oApp:nRowsInt == 0 ,{ CLR_BLACK, oApp:nRowParClr },{ CLR_BLACK, oApp:nRowNonClr }) }
:nRecSelColor := oApp:nRowParClr
:lDisplayZeros := (.F.)
:blDblClick := { | nRow, nCol, nKey | Editar(oBrw,(.F.))}
:bKeyDown := { | nKey, nFlags | IIF(nKey == VK_RETURN,Editar(oBrw,(.F.)),)}
:SetTree()
:oTree:OpenAll()
WITH OBJECT :aCols[01]
:cOrder := "A"
END
END
thank you very much
Re: Mr. Rao, refresh a Tree
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Thu Feb 08, 2024 9:25 am
by nageswaragunupudi
Please try this sample and use the logic suitably
- Code: Select all Expand view
#include "fivewin.ch"
function Main()
local oCn := maria_Connect( "209.250.245.152,fwh,fwhuser,FiveTech@2022" )
local oRs, cSql
local oDlg, oBrw, oFont
FWNumFormat( "A", .t. )
SetGetColorFocus()
cSql := "SELECT STATE,CITY,SALARY FROM customer ORDER BY STATE"
oRs := oCn:RowSet( cSql )
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE DIALOG oDlg SIZE 400,600 PIXEL TRUEPIXEL FONT oFont
@ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
DATASOURCE oRs AUTOCOLS ;
CELL LINES FOOTERS NOBORDER FASTEDIT
WITH OBJECT oBrw
:nStretchCol := 1
WITH OBJECT :Salary
:nFooterType := AGGR_SUM
:nEditType := EDIT_GET
END
:MakeTotals()
:SetTree()
:oTree:OpenAll()
:lDisplayZeros := .f.
WITH OBJECT :Salary
:bEditWhen := { || oBrw:oTreeItem:oTree == nil }
END
:bClrStd := { || { CLR_BLACK, If( oBrw:oTreeItem:oTree == nil, CLR_WHITE, CLR_YELLOW ) } }
:CreateFromCode()
END
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
oRs:Close()
oCn:Close()
return nil
Re: Mr. Rao, refresh a Tree
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Thu Feb 08, 2024 9:40 am
by Marc Venken
Nice, Mr. Rao, could you also change it for a Local DBF please ? I see a option to use this.
Re: Mr. Rao, refresh a Tree
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Thu Feb 08, 2024 3:34 pm
by nageswaragunupudi
Same logic for any data source
- Code: Select all Expand view
#include "fivewin.ch"
REQUEST DBFCDX
function Main()
local oDlg, oBrw, oFont
RDDSETDEFAULT( "DBFCDX" )
FWNumFormat( "A", .t. )
SetGetColorFocus()
// By way of caution let is reindex
FERASE( "CUSTOMER.CDX" )
USE CUSTOMER EXCLUSIVE
FW_CdxCreate()
CLOSE DATA
//
USE CUSTOMER SHARED
SET ORDER TO TAG STATE
GO TOP
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE DIALOG oDlg SIZE 400,600 PIXEL TRUEPIXEL FONT oFont
@ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
DATASOURCE "CUSTOMER" ;
COLUMNS "STATE","CITY","SALARY" ;
CELL LINES FOOTERS NOBORDER FASTEDIT
WITH OBJECT oBrw
:nStretchCol := 1
WITH OBJECT :Salary
:nFooterType := AGGR_SUM
:nEditType := EDIT_GET
END
:MakeTotals()
:SetTree()
:oTree:OpenAll()
:lDisplayZeros := .f.
WITH OBJECT :Salary
:bEditWhen := { || oBrw:oTreeItem:oTree == nil }
END
:bClrStd := { || { CLR_BLACK, If( oBrw:oTreeItem:oTree == nil, CLR_WHITE, CLR_YELLOW ) } }
:CreateFromCode()
END
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
CLOSE DATA
return nil
Re: Mr. Rao, refresh a Tree
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Fri Feb 09, 2024 12:08 am
by Armando
Mr. Rao:
the browse recordset has several columns although in the browse I only show three,
the ones necessary to form the tree, and the editing of all the columns is done in a dialog,
I am going to upload a video to better explain my problem, may I?.
For me and my client your support is very important.
With best regards
Re: Mr. Rao, refresh a Tree
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Fri Feb 09, 2024 12:42 am
by Armando
Mr. Rao:
This is my video, it is 18 seconds, if you consider it necessary, I will send you my entire PRG, help me please.
Greetings
https://files.fm/u/u25vv7ebbv
Re: Mr. Rao, refresh a Tree
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Fri Feb 09, 2024 12:57 am
by nageswaragunupudi
We will definitely support you.
I can not see the video but that does not matter.
Are you using FWH builtin Maria/MySql lib?
Also your FWH version.
Re: Mr. Rao, refresh a Tree
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Fri Feb 09, 2024 1:00 am
by nageswaragunupudi
Also can you connect to our Cloud server
"208.91.198.197:3306,fwhdemo,gnraofwh,Bharat@1950"
and upload your table there?
Re: Mr. Rao, refresh a Tree
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Fri Feb 09, 2024 1:03 am
by Armando
Mr. Rao:
Thank you very much in advance
To see the viedo just clic on this link
https://files.fm/u/u25vv7ebbvMy Tools.
FWH 2307
MySql 5.1
Harbour &
BCC7
Regards, and thanks again
Re: Mr. Rao, refresh a Tree
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Fri Feb 09, 2024 1:11 am
by Armando
nageswaragunupudi wrote:Also can you connect to our Cloud server
"208.91.198.197:3306,fwhdemo,gnraofwh,Bharat@1950"
and upload your table there?
Mr. Rao:
Done, you will need 3 tables, Marcas, Modelos and Partes
Best regards
Re: Mr. Rao, refresh a Tree
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Fri Feb 09, 2024 2:06 am
by nageswaragunupudi
I get the error "the site can not be reached"
Re: Mr. Rao, refresh a Tree
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Fri Feb 09, 2024 2:13 am
by nageswaragunupudi
Please also give me the SQL to read the data from the 3 tables
Re: Mr. Rao, refresh a Tree
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Fri Feb 09, 2024 2:16 am
by Armando
Mr. Rao:
May I send the video to your email?, pls give me your a¿email adreess.
- Code: Select all Expand view
// Record Set de Partes
oRsPar := FW_OpenRecordSet(oApp:oCon,"SELECT " +;
"*," +;
"MAR_DES," +;
"MOD_DES " +;
"FROM " +;
"Partes " +;
"LEFT JOIN " +;
"Marcas " +;
"ON " +;
"PAR_MAR = MAR_NUM " +;
"LEFT JOIN " +;
"Modelos " +;
"ON " +;
"PAR_MAR = MOD_MAR " +;
"AND " +;
"PAR_MOD = MOD_COD " +;
"ORDER BY " +;
"PAR_MAR,PAR_MOD,PAR_COD",adLockOptimistic,adOpenDynamic,0)
IF oRsPar:BOF() .AND. oRsPar:EOF()
ELSE
oRsPar:MoveFirst()
ENDIF
Regards
Re: Mr. Rao, refresh a Tree
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Fri Feb 09, 2024 2:29 am
by nageswaragunupudi
email:
nageswaragunupudi [at] gmail [dot] com
Re: Mr. Rao, refresh a Tree
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Fri Feb 09, 2024 2:35 am
by Armando
Mr. rao:
Sent it.
Regards