xBrowse + MySql and SetCheck ( logic field )

xBrowse + MySql and SetCheck ( logic field )

Postby Rimantas » Sat Mar 02, 2013 2: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: Select all  Expand view

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:Svarbus:AddResource( "ON" )
//oBrw:Svarbus: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.
User avatar
Rimantas
 
Posts: 437
Joined: Fri Oct 07, 2005 12:56 pm
Location: Utena , Lithuania

Re: xBrowse + MySql and SetCheck ( logic field )

Postby nageswaragunupudi » Sat Mar 02, 2013 3:23 pm

Please set
Code: Select all  Expand view

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
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xBrowse + MySql and SetCheck ( logic field )

Postby Rimantas » Sat Mar 02, 2013 3:48 pm

nageswaragunupudi wrote:Please set
Code: Select all  Expand view

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 ! :D
Rimantas U.
User avatar
Rimantas
 
Posts: 437
Joined: Fri Oct 07, 2005 12:56 pm
Location: Utena , Lithuania

Re: xBrowse + MySql and SetCheck ( logic field )

Postby nageswaragunupudi » Sat Mar 02, 2013 5:24 pm

Either you need to show checkbox or combobox. Not both.
If instead of checkbox you like to show combobox.

Code: Select all  Expand view
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
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xBrowse + MySql and SetCheck ( logic field )

Postby Rimantas » Sat Mar 02, 2013 7:26 pm

nageswaragunupudi wrote:Either you need to show checkbox or combobox. Not both.
If instead of checkbox you like to show combobox.

Code: Select all  Expand view
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.
User avatar
Rimantas
 
Posts: 437
Joined: Fri Oct 07, 2005 12:56 pm
Location: Utena , Lithuania

Re: xBrowse + MySql and SetCheck ( logic field )

Postby nageswaragunupudi » 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
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 95 guests