Gadget

Q:

I’ve a Form Section, with a Grid Gadget.

If I try to set:
oGridGadget = lianja.get(“mypage.section.gridgadget”)
oGridGadget.clear()
oGridGadget.setattr(“controlSource”, “filterricerca”)
I get the error:
gio ott 6 10:10:16 2016
**** Lianja error ****
USE “filterricerca” IN 0
^
File ‘filterricerca.dbf’ does not exist

where filterricerca is a cursor:
create cursor filterricerca (&cursorField)
select filterricerca
append blank

Is possible to use a cursor as a datasource of a Grid Gadget?

A:

No, it expects a table name.

A2:

I believe you can also use temp tables (at least that how I understand them) instead of a cursor.

If you select into a table that has a name that starts with an underscore, it is not part of the database.
select * from a into _temp1.

You can create a temporary table that is not in the database.

I know of two ways.

1. Create table c:\tempfabio free(Firstname Char(10), Id int)

By using the word free, it keeps it standalone.

2. use a table that starts with an underscore.

Select * from masterfabio into table _tempfabio


 

Advertisements

Gadget

Q:
in a standard section, I’ve iserted a simple VFP Gadget, with 2 label and 2 textbox.
When I load the page, the gadget is correctly populated.
When I skip records of section, how I can refresh the gadget object?
A:
A custom gadget should have a refresh method which is called when required.
It’s a method in the gadget object.
Declare public variables and assign the objects. These public variables should be in a namespace if you edited the custom gadget through the UI.
a page with 2 section:

in the seconds section I’ve inserted a VFP Gadget:
on the “Custom filename”: gadget2.prg

Code:
//
// Lianja custom recital gadget "gadget2"
//
namespace martinelli_articoli 
        public des_web, testo_web
       
define class gadget2 as gadget
        proc init()
                // place your section "init" code here
        endproc

        proc add()
                // place your section "add" code here
        endproc

        proc delete()
                // place your "delete" code here
        endproc

        proc first()
                // place your goto "top" here
        endproc

        proc previous()
                // place your move "previous" code here
        endproc

        proc next()
                // place your move "next" code here
        endproc

        proc last()
                // place your goto "bottom" code here
        endproc

        proc watch()
                // place your "watch" code here
        endproc

        proc refresh()
                // place your "refresh" code here
                des_web.text = Q_RemoveHTMLTag(ARTICOLI.DES_WEB)
                testo_web.text = Q_RemoveHTMLTag(ARTICOLI.TESTO_WEB)           
        endproc
enddefine

proc gadget2 
        gadget2 = createobject("gadget2")

        gadget2.addobject("lbl_desweb", "Label")
        lbl_desweb.caption = "Descrizione WEB"

        gadget2.addobject("des_web", "Textbox") 
        des_web.text = Q_RemoveHTMLTag(ARTICOLI.DES_WEB)
       
        gadget2.addobject("lbl_testoweb", "Label")
        lbl_testoweb.caption = "Testo WEB"
        gadget2.addobject("testo_web", "Textbox") 
        testo_web.text = Q_RemoveHTMLTag(ARTICOLI.TESTO_WEB)
                 
        // 
return gadget2

The grid gadget example
grid Gadget Example Lianja – https://youtu.be/a0v3GYwO3h8


Q:
Actionbar. How to hide it in the grid gadget?


A:
.actionbar =.f.



 

Gadget

Q: 
Which delegate of the Custom section should I put the AddObject() method?
A:
There is no delegate involved in creating a custom gadget. Hover the mouse over the gadget header and click the keyboard icon. You will then be in the script editor for that custom gadget. That is where you create your custom gadget UI.