Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using 2 combobox in grid filtered
Message
De
01/06/2020 19:04:22
Luis Santos
Biglevel-Soluções Informáticas, Lda
Portugal
 
 
À
01/06/2020 07:02:43
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01673609
Message ID:
01674661
Vues:
69
Ok, Luís, back to your initial question(s):

> [Part 1] I need to create 2 comboboxes in a grid with bindevents (I need to use Bindevents, because i dont have access to code source) , and [Part 2]when I select an item in combo 1, the second combobox returns the filtered records.
> both combobox's recordsourcetype is SQL and will return a cursor.

Starting with Part 1

You said later on the thread that you can edit the form. Can you add controls freely, or the only thing you can do is to work on the code of existing controls (like the grid)?

Hello António,

Yes , i can add controls (textbox, editbox, grids, ..). i can also with this code add new fields on the original grid. Ex:
local MyForm
** por cada ecrã (form) que esteja aberto na aplicação
for each MyForm in _screen.Forms

** Se se tratar do ecrã de clientes
if MyForm.name="SCL"
**Adiciona o objecto Label ao ecrã de clientes
Myform.Pageframe1.Page2.addobject("u_bancoL","NOSSOLABEL")
** define algumas propriedades da label
With MyForm.Pageframe1.Page2.u_bancoL
.Top=230
.Left=315
.AltTop=.F.
.Caption="Venda a Cargo de :"
** método interno e obrigatório:
.IniOffset()
.Visible=.t.
EndWith

** Adiciona o objecto ComboBox ao ecrã de clientes
Myform.Pageframe1.Page2.addobject("u_banco","NOSSOCOMBOBOX")
** define algumas propriedades da combobox
With MyForm.Pageframe1.Page2.u_banco
.Top=230
.Left=425
.width=140
.Height=19
.AltTop=.F.

.FazShowsave = .t.
** controlsource da combobox é o campo de utilizador "u_banco"
.ControlSource="cl.u_banco"

** define valores fixos para a combobox, cada valor é separado por virgula
.Rowsource="Sul,Centro,Norte,Indefinido"
** obrigatório ser 1 para apresentar os valores definidos 
** pela propriedade Rowsource
.RowsourceType=1

.Statusbartext="Responsabilidade da Venda"
.Tooltiptext="Responsabilidade da Venda"
** método interno e obrigatório:
.IniOffset()
.Visible=.t.
EndWith

exit
endif
next MyForm
I can do that by specifying Keyboard keypress combination, but depending on the version software , the same have Events that can apply to my form.
For example on the higher version , i have events [ON INIT] that i can use do run the code above. simply, i must specify:

Screen Form to apply: SCL
Evento fixo: Aposinitdoform (OnINIT)
Condição lógica: .T. (Logic condition, that can be also Xbase code)
A reacção é do tipo: Correr uma expressão(the type of reaction, i that case, running Xbase expression)

My intention is to create a Bindevent in a grid (not the original one) and write an Xbase expression to execute, in this case create 2 combobox, as the grid is always refreshed, when starting with the Form the 2 combobox will be created dynamically.
The next trick will be to control when selecting an option on the first to be able to filter the content on the second.

I hope I managed to answer your question in the best way.

Best regards,
Luis
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform