Jump to content

Findcomponent causes AV


MarkLince

Recommended Posts

Hi,

I have a Frame with a scrollbox on it and some labels and listboxes on the scrollbox. 

The labels and listboxes are named ADLabel1, ADlabel2, ADLabel3 ....  and similarly the listboxes.

 

trying to cycle through the controls and change properties using for example;

 

for count1:= 0 to mystringlist.count-1 do

begin

   TUniLabel(FindComponent('ADLabel'+inttostr(count1+1))).caption:=mystringlist[count1];

end;

 

But this causes an AV, searched through forum and fincomponent seems to have been a problem in early builds of uniGUI, is it still a problem??

 

I have tried lots of variations of findcomponent but nothing seems to work. 

 

So... any help is gratefully received.

 

Regards

Mark

 

 

Link to comment
Share on other sites

Hi Farshad,

Thanks for a quick reply, yes as you say, findcomponent is returning nil and therefore causes AV in my code sample.

I have also tried;

 

var

ADlabel:Tunilabel;

 

 ADLabel:=TUniLabel(ADScroll1.FindComponent('ADLabel'+inttostr(count1+1))); 

 if not (AdLabel = nil) then
 begin
     ADLabel.Caption:='Test';
 end;
 
and of course no AV and caption is not set as ADLabel is nil, but I don't understand why it should be nil. as there is a component called "ADLabel1, ADLabel2, ....." with parent ADScroll1
 
What am I missing? 
 
Thanks
Mark
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...