mIRC Homepage
Posted By: uicn_renegade error loading icon in dialog - 28/03/04 08:44 PM
I am trying to use an icon within the dialog window itself, not in the title bar.

I have set the path to the icon to a variable using $findfile.

Code:
on *:load: { set -n %renepic $findfile(C:\,renemp3ic0n.bmp,1)


The variable stores the path correctly.

Code:
dialog lilmp3 {
  title "reneMPĀ³"
  size -1 -1 370 340
  option pixels
  icon 1, 312 13 41 48,%renepic
  ......


//echo %renepic yeilds: C:\3515\renemp3ic0n.bmp (which is the correct location of the .bmp)

Upon first execution of the dialog, it displays everything properly.

The problem comes when the dialog is closed , and on next start.

* /dialog: 'lilmp3' error loading icon '0 C:\3515\renemp3ic0n.bmp'

I am not sure what/where/why the area in red from the error message is there, but it seems to be what is causing my problem:

* /dialog: 'lilmp3' error loading icon '0 C:\3515\renemp3ic0n.bmp'

If I merely use the path itself in the dialog table it works perfectly, only when I introduced the variable did I encounter any problems. I want to search for the icon itself as I dont know the filepath where anyone whom I may give this to will put it.

My short term remedy is to now just search for the icon eveytime the dialog is executed, but dont really think that should be necessary once it has been set.
Posted By: tidy_trax Re: error loading icon in dialog - 28/03/04 09:17 PM
it needs a space:
icon 1, 312 13 41 48,%renepic
should be
icon 1, 312 13 41 48, %renepic
Posted By: uicn_renegade Re: error loading icon in dialog - 28/03/04 09:24 PM
hrmmm,

same problem with a space.

* /dialog: 'lilmp3' error loading icon '0 C:\3515\renemp3ic0n.bmp'


And, as I edited the script, I had it without the space, yet it works fine as long as:

1. you set the variable on each execution of the dialog

2. you hard code the path.

icon 1, 312 13 41 48,C:\3515\renemp3ic0n.bmp

and

icon 1, 312 13 41 48, C:\3515\renemp3ic0n.bmp

both work exactly the same.

Using the variable also is the same with or w/o space. Will only work if the variable is set on each execution.
Posted By: MIMP Re: error loading icon in dialog - 29/03/04 05:28 PM
Icons can be embedded into files, (like the many mIRC icons in the mIRC.exe.) So you have to reference which one to retreieve. I'm pretty sure after the filename in the icon line you should be referencing an index number:

icon 1, 312 13 41 48, %renepic 1

The error you're getting is that it cannot find an icon with the index of 0.
Posted By: qwerty Re: error loading icon in dialog - 29/03/04 07:56 PM
The actual problem is that mirc is inconsistent regarding the order of index and filename in different scripting elements that have to do with dialog icons. The details are described here.

Btw, icon indexing is zero-based, so if the icon #1 exists, #0 would definitely exist too wink


uicn_renegade: I would advise against using variables in icon definitions, for now. The workaround is pretty simple too: just use the on dialog init and close events to load/save the icon yourself.
Posted By: uicn_renegade Re: error loading icon in dialog - 29/03/04 10:03 PM
Excellent info, thanks to both of you.

I did not realize that the icons were indexed.

I will leave it as I currently have it, which is just to search for the icon each time on init. It is quite effective.
© mIRC Discussion Forums