Recent

Author Topic: Probably a dumb question about procedures and objects on form - maybe??  (Read 3216 times)

wpflum

  • Sr. Member
  • ****
  • Posts: 276
I'm not even sure how to word this so I'll describe it.  :-[

I have a form, Form1, I'm using as a popup to set up default settings.  I can use the controls to get a selection in a list box, listbox1, but if I try to access the listbox in a procedure I want to create to do background stuff to the form I have to use Form1.listbo1.yadyada instead of just listbox1.yadayada.  This procedure is in the same file as Form1 is using and I was wondering why I'm having to do this??  Is it normal or did I mess something up or miss something when I declared the procedure that makes me have to use the whole thing instead of just for control name itself.  Not a huge deal but I just like to keep things as simple as possible and to me listbox1.yadayada is neater looking then Form1.listbox1.yadayada.

Bill

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4383
  • I like bugs.
Re: Probably a dumb question about procedures and objects on form - maybe??
« Reply #1 on: August 31, 2010, 06:35:14 pm »
Make the procedure a method belonging to class TForm1 and then it can access all members of its class.

Juha
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

wpflum

  • Sr. Member
  • ****
  • Posts: 276
Re: Probably a dumb question about procedures and objects on form - maybe??
« Reply #2 on: August 31, 2010, 06:40:00 pm »
I knew it was something simple.   :-[

Thanks


 

TinyPortal © 2005-2018