Re: Help with firing an event from a button

[email protected]
Newsgroups gmane.comp.gnu.enterprise.general
Message-ID <[email protected]>
El jue, mar 25, a las 15:25:57 James Thompson escribía:
> >
> > ...
> >
> 
> ...
> 
> Any time you see events mentioned inside the forms code base.  You are dealing 
> with gnue-common's event dispatcher.  These events are internal to the forms 
> code and and not meant to be exposed to the trigger programmer.   The event 
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

> >
> > What I'd like is having a button with that functionality, as toolbar has
> > for next/previous/first/last records.
> 
> blockName.nextRecord()
> blockName.prevRecord()
> blockName.firstRecord()
> blockName.lastRecord()
> 
> > I've been looking at GFBlock, and found that with block methods, I'll
> > have to do a loop for '@rows' number or so. How can I get block/@rows
> > value?
> 
> I dont understand what you are after here?  Can you give more detail.
> 
> > In the other way, I suppose it should be possible to fire JUMPROWSXXX
> > events that would do the job. I've tried form.dispatchEvent() also,
> > but I got an Exception saying dispatchEvent was an unknown attribute,
> > thought it's a method from GFForm.
> 
> Events are internal only.  Trying to dispatchEvent() inside a trigger could                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> lead to deadlock situations.  No methods from the GFForm should be run from 
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

> inside a trigger.  If you need a function exposed that isn't you will have to 
  ^^^^^^^^^^^^^^^^^

> add it to GFForm's self._triggerFunctions dictionary.  Depending on what you 
> are trying to do you might have to write a bit of wrapper code in their as 
> well.  Before you start hacking forms internal structures you'd probably want 
> to post here first.  As we may have a way of doing that already.  If not, 
> we'd like to make sure it fits the direction we're headed.  Then we could see 
> about adding it into the main code base for everyone to benifit from.
> 
> >
> > And I've looking for a way to customize toolbar and found defined at
> > ToolBar.py. I'm new to python, but I've seen, at documentation,
> > that yo can derive a new class with same that parent: could I do that
> > with ToolBar, redefining _DEFAULT_TOOLBAR and loading derived class via 
> > ImportPath to get a customized toolbar?
> 
> I don't think deriving a new class internally would be the way to do this.
> 
> We don't have a proper way to extend the toolbar/menu system yet.  ...

Thanks a lot for your explanation.

What I wanted was got the functionality of shift-PgUp shift-PgDn with a
button. I've considered three alternatives:

a) As long as the code for doing that is written, and reached via events
attached to keystrokes, I thought should be possible fire the event from
a trigger. Now, I know it's better not to do it.

b) Do it looping needed times blockname.prevRecord()/nextRecord(), but
the value of block/@rows is needed for this to be done, and I don't know
how, if can, to get it.

c) Add buttons to toolbar throwing those specific events, but now I know
that's no prevision for toolbar customization.

So, if you know a way I could get the value of rows attribute of block
element, I could do it. If not, I will attach a label to let my users
know that shift-PgDn/shift-PgUp do the job.

I've developed and maintained for many years enterprise apps, and I know
exactly what UI functionality I need. As a programmer, it's supposed I
am able to implement them for my users, but I'm new both to GNUe and
python, and there are many things about both I must know before
implementing solutions for things I care. Of course, when it's the
moment, I'll try it looking with all of you the best way from GNUe point
of view.

Thanks a lot for your efforts.
-- 
José Esteban
Granada - Spain
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.