[Gambas-user] A few questions
Doriano Blengino
doriano.blengino at ...1909...
Tue Sep 23 21:39:23 CEST 2008
Hi,
I am facing a series of little problems (gambas v. 2.0.0).
I made a fmPreview which, by raising a "getpage" event, gets data from
the main program and displays them, and/or actually prints them on a
printer.
fmPreview is a form with a few controls in it. fmPreview itself raises a
"getpage" event, which is to be catched by the main program in order to
send data to print. fmPreview catches events from its own controls
(buttons, form events like resize and so on).
The main initiates a preview/print operation by doing this:
fmPreview.setup("caricopriv", 1350, 2300) ' name of the print and page dimensions
fmPreview.obs = NEW Observer(fmPreview) AS "preview"
reply = fmPreview.showmodal() ' start operation
The observer is needed because, without it, the "instantiating" program
can not get the event to send page data.
When fmPreview terminates its duty, in its close() methods, it issues
these instructions:
object.Detach(obs)
obs = NULL
The previous two instructions should get rid of the observer. This is
needed because otherwise every time the main program opens up an
fmPreview, a new observer has to be created.
My questions are:
1) Is this the correct way to destroy an observer? I did not find
another way - both instructions are needed, it seems. I hoped an
"Object.destroy(...)" was present...
2) I tried to not to use an observer, but attach/detach seem to catch
all events involved in fmPreview - both the ones generated by fmpreview
and the ones generated by fmPreview child controls.
3) I tried to instantiate an observer directly from fmPreview, instead
of the main program, and then object.attach() it to the main program,
but it didn't work.
4) Probably, using "hPreview = NEW fmPreview(...) as "preview" would
solve, but I would try to understand better how to use an observer,
attach/detach and so on. My goal would be to instantiate fmPreview with
only two lines of code (ok, not a so great deal...), or just one line:
the event name to be raised could be the same as the title of the print.
5) Does TableView raise keypress events when in edit mode? I see
nothing, but I would need it to do certain things. Is there another way
to do a controlled editing in a tableview?
Thanks in advance,
best regards,
Doriano Blengino
More information about the User
mailing list