If you would like to change the data of Presta direct, try this code. Just tried it myself and working (change your data, PW,..)
Second a folder with some Xbrowses.
Code: Select all | Expand
static function Prestabeheer()
local oDlg, oFont, nWild := 1, cZoek:=""
local cList, aFlds, aHdrs, oBold
local nChoice, uDataSource, nCombo1:= 1 , nCombo2:= 1
local aTabs:={"Kleuren","Volgorde"}
local oBrw[5]
Public oRsATT
Public cServer := "YOUR DATA HERE"
Public cDataBase := ""
Public cUser := ""
Public cPassWord := ""
Public oCn, oRs, oRsATT, oRsVolgorde
FWCONNECT oCn HOST cServer USER cUser PASSWORD cPassword DATABASE cDatabase
if oCn == nil
? "Failed to connect"
return nil
endif
oRsProduct := oCn:RowSet( "select * from ps_product_lang " )
xbrowse(oRsProduct)
cZoek := "1"
oRs := oCn:RowSet( "select * from `ps_attribute` where `id_attribute` = ? ", { cZoek } )
oRsAtt:= oCn:RowSet( "SELECT * FROM `ps_attribute_lang` where `id_lang` = ? ORDER BY id_attribute", { "1" } )
cDbf:="c:\data\temp.dbf"
oRsAtt:savework(cDbf)
oRsGroepen:= oCn:RowSet( "SELECT * FROM `ps_category_lang` where `id_lang` = ? ", { "1" } )
cZoekProduct := "77"
oRsvolgorde:= oCn:RowSet( "SELECT * FROM `ps_category_product` where `id_category` = ? ", { cZoekProduct } )
oRsvolgorde:= oCn:RowSet( "SELECT *,P.description_short AS PName FROM ps_category_product C LEFT JOIN ps_product_lang P ON C.id_product WHERE id_category = ?" )
DEFINE FONT oBold NAME 'CALIBRI' SIZE 0,-12 BOLD
DEFINE FONT oFont NAME "CALIBRI" SIZE 0,-12
DEFINE FONT oFontS NAME "Segoe UI" SIZE 0,-09
DEFINE DIALOG oDlg SIZE 1410,800 PIXEL TRUEPIXEL ;
STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION, WS_SYSMENU,WS_MAXIMIZEBOX, WS_MINIMIZEBOX, WS_THICKFRAME );
TITLE "Ploegen";
GRADIENT { { 1, nRGB( 125, 155, 175 ), nRGB( 125, 155, 175 ) } }
DEFINE BUTTONBAR oBar OF oDlg SIZE 56,56 2007
@ 90,05 FOLDER oFld SIZE 1400,700 PIXEL OF oDlg ITEMS aTabs
///////////////////////////////////////////////////////////////// BRW FOLDER 1 /////////////////////////////////////////////////
aVelden1 := { ;
{ "id_attribute" , "ID" ,nil, 50 }, ; // 1
{ "id_lang" , "Taal" ,nil, 50 }, ; // 2
{ "name" , "Kleurnaam" ,nil, 100 }} // 9
@ 1,1 XBROWSE oBrw[1] size 1400,100 PIXEL OF oFld:aDialogs[ 1 ] font oFont ;
DATASOURCE oRsATT;
COLUMNS aVelden1;
AUTOSORT CELL LINES NOBORDER FOOTERS
//FASTEDIT
oBrw[1]:nEditTypes = EDIT_GET
oBrw[1]:SetChecks()
oBrw[1]:lF2KeyToEdit := .t. // Edit when F2 is pressed
oBrw[1]:nHeadStrAligns := AL_CENTER
WITH OBJECT oBrw[1]
:lColChangeNotify := .t.
:oHeaderFonts := oBold
:bClrEdits := { || { CLR_BLACK, CLR_YELLOW }}
:bClrRowFocus := { || { CLR_BLACK, RGB(185,220,255) } }
:nColDividerStyle := LINESTYLE_LIGHTGRAY
:nRowDividerStyle := LINESTYLE_LIGHTGRAY
:bClrRowFocus := { || { CLR_BLACK, RGB(185,220,255) } }
:nMarqueeStyle := MARQSTYLE_HIGHLROWMS
:bOnChange := { || oRs:Requery( { oBrw[1]:ID:Value } ), oBrw[2]:refresh() }
:bRClicked := {|nRow, nCol| Prestapop( nRow,nCol, oBrw[1], oRsATT ),oBrw[1]:refresh() }
:bKeyDown := { |nKey| If( nKey == VK_DELETE, oBrw[1]:kleurnaam:varput("##DEL"+oBrw[1]:kleurnaam:value), nil ) }
:lFooter := .t.
:bRecSelHeader := { || "RowNo" }
:bRecSelData := { |o| o:KeyNo }
:bRecSelFooter := { |o| o:nLen }
:oRecSelFont := oFont // optional
:nRecSelWidth := "99999" // required size
END
oBrw[1]:CreateFromCode()
///////////////////////////////////////////////////////////////// BRW FOLDER 2 /////////////////////////////////////////////////
aVelden2 := { ;
{ "id_attribute" , "ID" ,nil, 50 }, ; // 1
{ "id_attribute_group", "Groep" ,nil, 50 }, ; // 2
{ "color" , "Kleur" ,nil, 55 }, ; // 9
{ "id_attribute" , "File" ,nil, 70 }} // 9
@ 105,1 XBROWSE oBrw[2] size 1400,200 PIXEL OF oFld:aDialogs[ 1 ] font oFont ;
DATASOURCE oRs;
COLUMNS aVelden2;
AUTOSORT CELL LINES NOBORDER FOOTERS
oBrw[2]:nRowHeight:= 70
oBrw[2]:nEditTypes = EDIT_GET
oBrw[2]:SetChecks()
oBrw[2]:lF2KeyToEdit := .t. // Edit when F2 is pressed
oBrw[2]:nHeadStrAligns := AL_CENTER
oBrw[2]:kleur:bClrStd := { || showcolors(oBrw[2]:kleur:Value) }
WITH OBJECT oBrw[2]
:lColChangeNotify := .t.
:oHeaderFonts := oBold
:nColDividerStyle := LINESTYLE_LIGHTGRAY
:nRowDividerStyle := LINESTYLE_LIGHTGRAY
WITH OBJECT :file
:bStrImage := { || "d:\pictures\kleuronline\"+alltrim(str(oBrw[2]:SelectedCol():Value))+".jpg" }
:oDataFont := oFontS
:nDataStrAlign := AL_CENTER + AL_BOTTOM
:nDataBmpAlign := AL_CENTER
:aImgRect := { nil, nil, -10, nil }
END
END
oBrw[2]:CreateFromCode()
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////
aVelden4 := { ;
{ "id_category" , "Cat_ID" ,nil, 50 }, ; // 1
{ "name" , "Naam" ,nil, 200 }, ; // 2
{ "position" , "Pos" ,nil, 50 }} // 9
@ 1,1 XBROWSE oBrw[4] size 1100,100 PIXEL OF oFld:aDialogs[ 2 ] font oFont ;
DATASOURCE oRsgroepen;
COLUMNS aVelden4;
AUTOSORT CELL LINES NOBORDER FOOTERS
//FASTEDIT
oBrw[4]:nEditTypes = EDIT_GET
oBrw[4]:SetChecks()
oBrw[4]:lF2KeyToEdit := .t. // Edit when F2 is pressed
oBrw[4]:nHeadStrAligns := AL_CENTER
WITH OBJECT oBrw[4]
:lColChangeNotify := .t.
:oHeaderFonts := oBold
:bClrEdits := { || { CLR_BLACK, CLR_YELLOW }}
:bClrRowFocus := { || { CLR_BLACK, RGB(185,220,255) } }
:nColDividerStyle := LINESTYLE_LIGHTGRAY
:nRowDividerStyle := LINESTYLE_LIGHTGRAY
:bClrRowFocus := { || { CLR_BLACK, RGB(185,220,255) } }
:nMarqueeStyle := MARQSTYLE_HIGHLROWMS
:lFooter := .t.
:bRecSelHeader := { || "RowNo" }
:bRecSelData := { |o| o:KeyNo }
:bRecSelFooter := { |o| o:nLen }
:oRecSelFont := oFont // optional
:nRecSelWidth := "99999" // required size
:bOnChange := { || oRSNewGroep(oBrw[4]:cat_id:Value), oBrw[3]:refresh() }
END
oBrw[4]:CreateFromCode()
///////////////////////////////////////////////////////////////// BRW FOLDER 3 /////////////////////////////////////////////////
aVelden3 := { ;
{ "id_category" , "Cat_ID" ,nil, 50 }, ; // 1
{ "id_product" , "Product_ID" ,nil, 70 }, ; // 2
{ "position" , "Pos" ,nil, 50 }, ; // 9
{ "oRsProduct:description_short" , "Naam" ,nil, 150 }} // 9
@ 110,1 XBROWSE oBrw[3] size 1100,200 PIXEL OF oFld:aDialogs[ 2 ] font oFont ;
DATASOURCE oRsvolgorde;
COLUMNS aVelden3;
AUTOSORT CELL LINES NOBORDER FOOTERS FASTEDIT
//oBrw[3]:nEditTypes = EDIT_GET
oBrw[3]:SetChecks()
oBrw[3]:lF2KeyToEdit := .t. // Edit when F2 is pressed
//oBrw[3]:nHeadStrAligns := AL_CENTER
WITH OBJECT oBrw[3]
:lColChangeNotify := .t.
//:oHeaderFonts := oBold
:bClrEdits := { || { CLR_BLACK, CLR_YELLOW }}
:bClrRowFocus := { || { CLR_BLACK, RGB(185,220,255) } }
:nColDividerStyle := LINESTYLE_LIGHTGRAY
:nRowDividerStyle := LINESTYLE_LIGHTGRAY
:bClrRowFocus := { || { CLR_BLACK, RGB(185,220,255) } }
:nMarqueeStyle := MARQSTYLE_HIGHLROWMS
//:bOnChange := { || oRs:Requery( { oBrw[1]:ID:Value } ), oBrw[2]:refresh() }
:lFooter := .t.
:bRecSelHeader := { || "RowNo" }
:bRecSelData := { |o| o:KeyNo }
:bRecSelFooter := { |o| o:nLen }
:oRecSelFont := oFont // optional
:nRecSelWidth := "99999" // required size
END
oBrw[3]:CreateFromCode()
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////
// BrwBarploegen( oBar, oBrw )
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
oCn:close()
return nil