[Gambas-user] Two many objects and two many forms

Fabien Bodard gambas.fr at ...626...
Thu Oct 11 08:35:17 CEST 2012


This is normal.
You define wkform as form.

Form does not accept have run sub... On the only symbols found available as
those of the class form.

You have too way to correct that

Make a parent that inherit of form and implement the needed symbol (just
empy subs), then make the fedits en héritage of it. Or more simple use
object type instead of of form
Le 11 oct. 2012 08:21, "Bruce" <bbruen at ...2308...> a écrit :

> :-Q
>
> I have a collection of objects, of two types, both of which inherit from
> the same superclass, "ActionItem".  One is a query, i.e. an object
> whose .CmdString is an SQL string; and the other is a command,
> whose .CmdString is a Shell string.  IOW:
>                            ActionItem
>                                 ^
>                                 |
>                 ________________________________________
>                 |                                      |
>            ActionQuery                           ActionCommand
>
> The only difference between ActionQuery and ActionCommand is they have
> different code for the "Exec" method in each of them.  (That either
> executes the query against the database on one hand and acts on the
> results or Shells the command "To" and interprets the return. That bit
> works fine.)
>
> What I cant work out is this.
>
> I have, by necessity, two editor forms that allow the user to configure
> the "ActionItems" in the collection.  (They are both fairly similar
> visually but have quite different internal code.)
> The user is presented with a list of the ActionItems in the main form
> and can select one and activate it's editor.
>         Public Sub mnuEditAction_Click()
>
>           Dim fec As FEditCommand
>           Dim feq As FEditQuery
>           Dim wkform As Form
>           Dim wkAction As CActionItem
>
>           If lvwActionList.Current.Selected Then
>             wkAction = $actions[lvwActionList.Key]
>             If wkAction.ActionType = "Command" Then
>               fec = New FEditCommand
>               fec.ActionItem = wkAction
>               wkform = fec
>             Else
>               feq = New FEditQuery
>               feq.ActionItem = wkAction
>               wkform = feq
>             Endif
>
>             If wkform.Run("Edit") Then            <---- FAILS HERE
>               wkform.ActionItem.Save
>               If wkform.ActionItem.Name = lvwActionList.Key Then
>                 $actions[lvwActionList.Key] = wkform.ActionItem
>               Else
>                 $actions.Add(wkform.ActionItem, wkform.ActionItem.Name)
>                 $actions.Remove(lvwActionList.Key)
>               Endif
>               LoadActionList
>             Endif
>           Endif
>         End
>
> The code fails with "Unknown Symbol 'Run' in class 'Form'". But both
> FEditCommand and FEditQuery have
>         Public Sub Run(Type As String) As Boolean
> methods.
>
> The debugger shows wkform as the correctly subclassed form (i.e.
> FEditCommand or FEditQuery).
>
> Any suggestions welcome.
>
> tia
> Bruce
>
>
>
> ------------------------------------------------------------------------------
> Don't let slow site performance ruin your business. Deploy New Relic APM
> Deploy New Relic app performance management and know exactly
> what is happening inside your Ruby, Python, PHP, Java, and .NET app
> Try New Relic at no cost today and get our sweet Data Nerd shirt too!
> http://p.sf.net/sfu/newrelic-dev2dev
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



More information about the User mailing list