Re: subclassed anti-alias canvas, and disappearing text




On Apr 17, 2006, at 8:16 AM, zentara wrote:

Anyways, this brings up an interesting question for me. Is using the
timer hack the only way of launching something from INIT_INSTANCE?

One thing you can do is detect that you're in property manipulation during INIT_INSTANCE, and cache the settings rather than actually applying them, and apply them at the next "checkpoint" (e.g., the next property set or method call after INIT_INSTANCE). This is what GtkWidget does for things that require the window to be realized.

The deferral trick you mentioned will work fine if you can guarantee that the main loop will run. And, actually, i'd recommend a single- shot idle rather than a timeout.

If both of those are simply too nasty, then more conventional tricks like breaking the initialization into two pieces will work... INIT_INSTANCE does next to nothing, but _finish_initialization() would do the rest, and should be called after the construction is complete. (We don't support GObject's constructor methods, but that's one instance in which they are used.)


By the way, i've never had good luck with adding canvas items to the canvas in INIT_INSTANCE.


--
Our enemies are innovative and resourceful, and so are we. They never stop thinking about new ways to harm our country and our people, and neither do we.
  -- President George W. Bush




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]