Author Topic: OnClick event stops working  (Read 1620 times)


  • Hero Member
  • *****
  • Posts: 933
Re: OnClick event stops working
« Reply #15 on: November 08, 2019, 12:25:53 pm »
Meanwhile, here is a thing.  I have found that renaming a 'dead' listbox revivifies it: the same old onclick event kicks back into life with no changes to the unit/frame other than those the IDE imposes when the name changes.  The compiler complains that 'the ancestor for [old name of control]' is missing.  I can overcome that by creating a new control with the old name (and no events).  The compiler is then content and the re-created control can just be ignored or hidden while the renamed control does the work. 

The risk here is that the revised listbox is being saved in the context of the form, not in the context of the frame. I'm pretty sure I've seen this sort of thing: when frames are good they are very very good, but when they are bad they are horrid :-)

Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.


  • Hero Member
  • *****
  • Posts: 7236
Re: OnClick event stops working
« Reply #16 on: November 08, 2019, 12:56:43 pm »
When ever I used frames I get a little upset when making changes to the frame itself it does not change in the forms that are using the frame
Changes made to a frame unit are updated in the form in which the frame is used only after closing and reloading that forrm. Yes, this is very annoying and confusing, and is one of the reasons why I almost always insert frames at runtime. The IDE uses a LOT of frames (see folder ide/frames), and they are always inserted at runtime.
« Last Edit: November 08, 2019, 12:59:06 pm by wp »
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10


  • Hero Member
  • *****
  • Posts: 3116
Re: OnClick event stops working
« Reply #17 on: November 08, 2019, 11:15:22 pm »
I suppose using dynamic frames could save some resources although I've never used them that way..

 I kind of think of them as my Library controls stash without making a control..

 I have very few frames. The ones I mostly use are for a menu entry that gets used in a lot of different ways but it keeps with the same format so the user does not get confused..
The only true wisdom is knowing you know nothing


  • New member
  • *
  • Posts: 8
Re: OnClick event stops working
« Reply #18 on: December 18, 2019, 05:41:30 am »
wp's post (reply #12) has solved the problem for me.  I converted all my use of frames to the scheme wp showed: create frames only at runtime, and use a TNotebook component to contain them.  For a month now they have all worked fine, with no recurrence of the problem I described at the top of this thread.

Many thanks to wp, Hero Member indeed!



TinyPortal © 2005-2018