How do I know the field name in xbrowse:column
How do I know the field name in xbrowse:column
I use XBROWSE with MySql. I would like to know the field name in column. Because the user can swap or hide the column.
for example
=============
XBROWSE COLUMN 'room', 'name', 'mobile'
if the user swap 'name' to 1st column, then when the user dblclick on 1st column. How do I know that it is field name 'name'?
Thank you in advance
for example
=============
XBROWSE COLUMN 'room', 'name', 'mobile'
if the user swap 'name' to 1st column, then when the user dblclick on 1st column. How do I know that it is field name 'name'?
Thank you in advance
Regards,
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
Re: How do I know the field name in xbrowse:column
Master Rao,
Is it possible, because when the user modify column such as swap or hide. It will effect, if that column (number) has action.
Is it possible, because when the user modify column such as swap or hide. It will effect, if that column (number) has action.
dutch wrote:I use XBROWSE with MySql. I would like to know the field name in column. Because the user can swap or hide the column.
for example
=============
XBROWSE COLUMN 'room', 'name', 'mobile'
if the user swap 'name' to 1st column, then when the user dblclick on 1st column. How do I know that it is field name 'name'?
Thank you in advance
Regards,
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
- nageswaragunupudi
- Posts: 10701
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 3 times
- Contact:
Re: How do I know the field name in xbrowse:column
All actions are attached to the column object and move with the column object.
For example:
When you define the browse, "room" is the first column.
You defined some action oBrw:aCols[ 1 ]:bLDClickData := {|| roomaction() }
Wherever the user moves / swaps this column, if the user clicks on the "room" column, the same action is taken.
All the datas/codeblocks assigned to a column pertain that column object, not to the visible serial number of the column.
For example:
When you define the browse, "room" is the first column.
You defined some action oBrw:aCols[ 1 ]:bLDClickData := {|| roomaction() }
Wherever the user moves / swaps this column, if the user clicks on the "room" column, the same action is taken.
All the datas/codeblocks assigned to a column pertain that column object, not to the visible serial number of the column.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: How do I know the field name in xbrowse:column
Dear Master Rao,
Thank you, it works fine for oBrw:aCols[ 1 ]:bLDClickData but I cannot find for ::bLClicked (Left single click) in TXBrwColumn.
Thank you, it works fine for oBrw:aCols[ 1 ]:bLDClickData but I cannot find for ::bLClicked (Left single click) in TXBrwColumn.
nageswaragunupudi wrote:All actions are attached to the column object and move with the column object.
For example:
When you define the browse, "room" is the first column.
You defined some action oBrw:aCols[ 1 ]:bLDClickData := {|| roomaction() }
Wherever the user moves / swaps this column, if the user clicks on the "room" column, the same action is taken.
All the datas/codeblocks assigned to a column pertain that column object, not to the visible serial number of the column.
Regards,
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
- nageswaragunupudi
- Posts: 10701
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 3 times
- Contact:
Re: How do I know the field name in xbrowse:column
There is no bLClicked data for TXBrwColumn.
The intention of the original authors of the XBrowse is not to use single-click for any action, because single-click is used for navigation in the browse. If an action is assigned to single click, there would be confusion between navigation and which cell to act upon.
Still if you want to assign action to single click, assign the action to oBrw:bRClicked and you can ascertain the active column with oBrw:SelectedCol()
The intention of the original authors of the XBrowse is not to use single-click for any action, because single-click is used for navigation in the browse. If an action is assigned to single click, there would be confusion between navigation and which cell to act upon.
Still if you want to assign action to single click, assign the action to oBrw:bRClicked and you can ascertain the active column with oBrw:SelectedCol()
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: How do I know the field name in xbrowse:column
Dear Master,
Thank you so much, I got it.
Thank you so much, I got it.
nageswaragunupudi wrote:There is no bLClicked data for TXBrwColumn.
The intention of the original authors of the XBrowse is not to use single-click for any action, because single-click is used for navigation in the browse. If an action is assigned to single click, there would be confusion between navigation and which cell to act upon.
Still if you want to assign action to single click, assign the action to oBrw:bRClicked and you can ascertain the active column with oBrw:SelectedCol()
Regards,
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
- nageswaragunupudi
- Posts: 10701
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 3 times
- Contact:
Re: How do I know the field name in xbrowse:column
oCol:cExpr --> FieldName
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: How do I know the field name in xbrowse:column
Dear Master,
It shows nothing (empty).
It shows nothing (empty).
nageswaragunupudi wrote:oCol:cExpr --> FieldName
Regards,
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
Re: How do I know the field name in xbrowse:column
Dear Mr.Rao,
oCol:cExpr is define columns name at first start. When hide some column, oCol:cExpr will show wrong fieldname.
oCol:cExpr is define columns name at first start. When hide some column, oCol:cExpr will show wrong fieldname.
nageswaragunupudi wrote:oCol:cExpr --> FieldName
Regards,
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
Re: How do I know the field name in xbrowse:column
I have these 2 functions
if XBrowse_FindCol(oBrw,'COST') > 0
oBrw:DelCol( XBrowse_FindCol(oBrw,'COST'))
ENDIF
and I added in xBrowse.prg the method fcol
oBrw:fCol('COST'):bEditWhen := {||iif( ::oRsRig:Fields( "PADRE" ):Value ==2,.F.,.T. )}
Maurizio
if XBrowse_FindCol(oBrw,'COST') > 0
oBrw:DelCol( XBrowse_FindCol(oBrw,'COST'))
ENDIF
Code: Select all | Expand
//-------------------------------------------------------------------------------------------
Function XBrowse_FindCol(o,cField)
Local n := 1 // := ascan(o:aCols,{|x| upper(x:cExpr)== upper(cField)})
local nH := 0
FOR n := 1 to len(o:aCols)
IF o:aCols[n]:lHide
nH ++
ENDIF
IF HB_IsString(o:aCols[n]:cExpr) .and. UPPER(o:aCols[n]:cExpr) == UPPER(cField)
Return n - nH
ENDIF
next
Return 0
and I added in xBrowse.prg the method fcol
oBrw:fCol('COST'):bEditWhen := {||iif( ::oRsRig:Fields( "PADRE" ):Value ==2,.F.,.T. )}
Code: Select all | Expand
// my_modi
METHOD fCol(cField) CLASS TXBrowse
Local n := 0
FOR n := 1 to len(::aCols)
IF HB_IsString(::aCols[n]:cExpr) .and. UPPER(::aCols[n]:cExpr) == UPPER(cField)
exit
ENDIF
next
return If( n > 0, ::aCols[ n ], nil )
Maurizio
Re: How do I know the field name in xbrowse:column
Dear Maurizio,
Thank you, this case has solved hide columns scenario.
Another scenario is swap column, I'm still got problem. I cannot check the current field on ::nColSel, if the user swap column.
Thank you, this case has solved hide columns scenario.
Another scenario is swap column, I'm still got problem. I cannot check the current field on ::nColSel, if the user swap column.
Maurizio wrote:I have these 2 functions
if XBrowse_FindCol(oBrw,'COST') > 0
oBrw:DelCol( XBrowse_FindCol(oBrw,'COST'))
ENDIF
Code: Select all | Expand
//-------------------------------------------------------------------------------------------
Function XBrowse_FindCol(o,cField)
Local n := 1 // := ascan(o:aCols,{|x| upper(x:cExpr)== upper(cField)})
local nH := 0
FOR n := 1 to len(o:aCols)
IF o:aCols[n]:lHide
nH ++
ENDIF
IF HB_IsString(o:aCols[n]:cExpr) .and. UPPER(o:aCols[n]:cExpr) == UPPER(cField)
Return n - nH
ENDIF
next
Return 0
and I added in xBrowse.prg the method fcol
oBrw:fCol('COST'):bEditWhen := {||iif( ::oRsRig:Fields( "PADRE" ):Value ==2,.F.,.T. )}Code: Select all | Expand
// my_modi
METHOD fCol(cField) CLASS TXBrowse
Local n := 0
FOR n := 1 to len(::aCols)
IF HB_IsString(::aCols[n]:cExpr) .and. UPPER(::aCols[n]:cExpr) == UPPER(cField)
exit
ENDIF
next
return If( n > 0, ::aCols[ n ], nil )
Maurizio
Regards,
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
Re: How do I know the field name in xbrowse:column
I use
cField := oBrw:aCols[oBrw:nColSel]:cExpr
Maurizio
cField := oBrw:aCols[oBrw:nColSel]:cExpr
Maurizio
Re: How do I know the field name in xbrowse:column
Dear Master Rao and Maurizio,
It works now.
Thanks both of you.
It works now.
Thanks both of you.
nageswaragunupudi wrote:oCol:cExpr --> FieldName
Regards,
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
- nageswaragunupudi
- Posts: 10701
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 3 times
- Contact:
Re: How do I know the field name in xbrowse:column
Clarification:
When xbrowse is created with columns clause like this:
The expressions listed in COLUMNS clause are stored in each oCol:cExpr.
So, oCol:cExpr need not always contain the field name, but actually the expression used in the COLUMNS clause.
When xbrowse is created with columns clause like this:
Code: Select all | Expand
COLUMNS "ITEM","UPPER(NAME)","QTY","PRICE","QTY * PRICE" ;
HEADERS "Item", "Name", "Quantity", "Rate", "Amount" ;
The expressions listed in COLUMNS clause are stored in each oCol:cExpr.
So, oCol:cExpr need not always contain the field name, but actually the expression used in the COLUMNS clause.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: How do I know the field name in xbrowse:column
Dear Master,
I got it, it works fine now. But the hidden is still a bit complicated clarify.
I got it, it works fine now. But the hidden is still a bit complicated clarify.
nageswaragunupudi wrote:Clarification:
When xbrowse is created with columns clause like this:Code: Select all | Expand
COLUMNS "ITEM","UPPER(NAME)","QTY","PRICE","QTY * PRICE" ;
HEADERS "Item", "Name", "Quantity", "Rate", "Amount" ;
The expressions listed in COLUMNS clause are stored in each oCol:cExpr.
So, oCol:cExpr need not always contain the field name, but actually the expression used in the COLUMNS clause.
Regards,
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)