FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xBrowse + MySql and SetCheck ( logic field )
Posts: 437
Joined: Fri Oct 07, 2005 12:56 PM
xBrowse + MySql and SetCheck ( logic field )
Posted: Sat Mar 02, 2013 02:55 PM
Hi,
Can you share with a sample for logic field with 2 state bitmaps ? I found samples in testxbrw.prg and xbrowgrd.prg . But something can't understand and that isn't working for me , I'm not seeing bitmaps ... :-)

Here is mine source :
Code (fw): Select all Collapse
DEFINE WINDOW oWnd TITLE "Užsakymai" MDICHILD OF wndMain()
    
@ 0, 0 XBROWSE oBrw OF oWnd DATASOURCE oQry COLUMNS aCol HEADERS aHdr

oBrw:nMarqueeStyle       := MARQSTYLE_HIGHLCELL
oBrw:nColDividerStyle    := LINESTYLE_BLACK
oBrw:nRowDividerStyle    := LINESTYLE_BLACK
oBrw:lColDividerComplete := .t.
oBrw:nFreeze             := 3

//oBrw:AddResource( "ON" )
//oBrw:AddResource( "OFF" )
oBrw:Svarbus:SetCheck( { "ON", "OFF" }, EDIT_LISTBOX, { cYs, cNo }  )

oBrw:CreateFromCode()
oWnd:oClient := oBrw
ACTIVATE WINDOW oWnd ON INIT oBrw:SetFocus()


At this moment bitmaps in RC . Can this be done with bitmaps files instead RC ?
MySql boolean type for column isn't strong define . I'm using "smallint" : 1 for true , 0 - false ...

Thanks in advance ! :-)
Rimantas U.
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse + MySql and SetCheck ( logic field )
Posted: Sat Mar 02, 2013 03:23 PM
Please set
Code (fw): Select all Collapse
oBrw:Svarbus:bEditValue := { || oQry:FieldGet( <nFldNo> ) == 1 }

where <nFldNo> is the field number to display as logical value.
After this call SetCheck() method
Regards



G. N. Rao.

Hyderabad, India
Posts: 437
Joined: Fri Oct 07, 2005 12:56 PM
Re: xBrowse + MySql and SetCheck ( logic field )
Posted: Sat Mar 02, 2013 03:48 PM
nageswaragunupudi wrote:Please set
Code (fw): Select all Collapse
oBrw:Svarbus:bEditValue := { || oQry:FieldGet( <nFldNo> ) == 1 }

where <nFldNo> is the field number to display as logical value.
After this call SetCheck() method


Thanks Rao ! This worked ! Very fine !

Can you explain also how to do "Yes/No" combobox for that to change values ?

Many thanks ! :-)
Rimantas U.
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse + MySql and SetCheck ( logic field )
Posted: Sat Mar 02, 2013 05:24 PM
Either you need to show checkbox or combobox. Not both.
If instead of checkbox you like to show combobox.

Code (fw): Select all Collapse
WITH OBJECT oBrw:Svarbus
   :bEditValue    := { |n| If( n == nil, nil, oQry:FieldPut( nFld, n ) ), oQry:FieldGet( n ) }
   :bStrData      := { || If( oBrw:Svarbus:Value == 1, "Yes", "No " }
   :nEditType     := EDIT_LISTBOX
   :aEditListTxt  := { "Yes", "No " }
   :aEditListBound:= { 1, 0 }  
END
Regards



G. N. Rao.

Hyderabad, India
Posts: 437
Joined: Fri Oct 07, 2005 12:56 PM
Re: xBrowse + MySql and SetCheck ( logic field )
Posted: Sat Mar 02, 2013 07:26 PM
nageswaragunupudi wrote:Either you need to show checkbox or combobox. Not both.
If instead of checkbox you like to show combobox.

Code (fw): Select all Collapse
WITH OBJECT oBrw:Svarbus
   :bEditValue    := { |n| If( n == nil, nil, oQry:FieldPut( nFld, n ) ), oQry:FieldGet( n ) }
   :bStrData      := { || If( oBrw:Svarbus:Value == 1, "Yes", "No " }
   :nEditType     := EDIT_LISTBOX
   :aEditListTxt  := { "Yes", "No " }
   :aEditListBound:= { 1, 0 }  
END


How we can edit checkbox ? Thanks !
Rimantas U.
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: xBrowse + MySql and SetCheck ( logic field )
Posted: Sun Mar 03, 2013 12:57 AM

Please let me know the code you have to write to set a new value to a field and save it to the table with TMySql library you are using.

Regards



G. N. Rao.

Hyderabad, India

Continue the discussion