Note that there are some explanatory texts on larger screens.

plurals
  1. PODelphi: "Resource not found" in design mode - why?
    primarykey
    data
    text
    <p>I got an error, and I don't know why I got it...</p> <p>So: I have a new component, based on sAlphaButton. This have ImageList property, and my component extend this button with my own captions/images, translated to hungarian.</p> <p>I used LoadRes to get the predefined images.</p> <p>See this:</p> <pre><code>procedure TScrollPNGButton.LoadAsImageListFromRes(ResNames : TStrings; IL : TsAlphaImageList); var s : string; i : integer; begin IL.CLear; for i := 0 to ResNames.Count - 1 do begin s := ResNames[i]; AddImageFromRes(hInstance, IL, s, ifPNG); end; end; procedure TScrollPNGButton.LoadResToImageList; var sl : TStringList; begin sl := TStringList.Create; try sl.Text := Trim( 'scrollpngbutton_ok'#13 + 'scrollpngbutton_cancel'#13 + 'scrollpngbutton_close'#13 + 'scrollpngbutton_yes'#13 + 'scrollpngbutton_no'#13 + 'scrollpngbutton_refresh'#13 + 'scrollpngbutton_print'#13 + 'scrollpngbutton_email'#13 + 'scrollpngbutton_add'#13 + 'scrollpngbutton_delete'#13 + 'scrollpngbutton_edit'#13 + '' ); LoadAsImageListFromRes(sl, FImgs); finally sl.Free; end; end; constructor TScrollPNGButton.Create(aOwner : TComponent); begin inherited Create(aOwner); FImgs := TsAlphaImageList.Create(nil); inherited Images := FImgs; LoadResToImageList; end; </code></pre> <p>It is working good when I use it from code. But when I registered it, and I try to put into a form, I got error:</p> <blockquote> <p>Error Resource scrollpngbutton_ok not found. OK </p> </blockquote> <p>I don't understand it, because I put the {$R *.res}, and from code this is working. Why the Resource not found? Is creation failed, or what?</p> <p>Ok, I can use Loaded; to set the images in design time, but Loaded is not called in runtime.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload