Koda

Welcome to Koda bug tracker!

At the moment you can post bugreports or suggestions anonymously. But registered users have some benefits: attaching files, commenting, voting, tracking tasks e.t.c.

Due some asshole started spamming tracker, now (at least for some time) it’s not allowed to create anonymous tasks. Sorry for unconvenience.

In edit fields you can use DokuWiki syntax for formatting.

Tasklist

FS#304 - Button icon bug: not visible at run time

Attached to Project: Koda
Opened by Chris Haslam (c.haslam) - Monday, 20 June 2011, 18:58 GMT+3
Type Bug Report
Category Application
Status Assigned
Assigned To Admin (Lazycat)
Operating System All
Severity Low
Priority Normal
Reported Version Development
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

With the attached .kxf file, the icon is visible at design time but not at run time. The icon is number 0 in shell32.dll. Other icons in shell32.dll work OK. Icon 0 in moricons.dll also does not work.

This may be an AutoIt error. If it is, is there a way for Koda to work around AutoIt’s bug?

This task depends upon

Comment by Chris Haslam (c.haslam) - Monday, 20 June 2011, 19:43 GMT+3

You will need to change the drive letter for the .dll file. Perhaps one day .kxf files will store @SystemDir rather than ?:\WINDOWS\System32.

Comment by Admin (Lazycat) - Tuesday, 21 June 2011, 11:09 GMT+3

A bit weird thing. This is what written in the Autoit docs:

<third param> [optional] Icon name if the file contain multiple icon. Can be an ordinal name if negative number. Otherwise -1.
Passing a negative number causes 1-based "index" behaviour. Some Dll can have icon extracted just with negative numbers.

So, this should work just like GUICtrlCreateIcon. Negative numbers - number of icon in the file.

But I not understand what "Otherwise -1" mean. What "-1" do here - clear icon? Stupid if so, since it's break "1-based index" rule.

Comment by Chris Haslam (c.haslam) - Tuesday, 21 June 2011, 17:59 GMT+3

I do not understand either, (but then I don't always understand what is written in the AutoIt doc, even though my first language is English!). Would you like to report this in Trac?

Comment by Chris Haslam (c.haslam) - Tuesday, 21 June 2011, 18:26 GMT+3

A work-around for Koda: rather than generating

GUICtrlSetImage(-1, "D:\WINDOWS\system32\shell32.dll", -1)

generate

GUICtrlSetImage(-1, "D:\WINDOWS\system32\shell32.dll", "1")

This could be done for all icon dlls in which icons are not named.

Comment by Chris Haslam (c.haslam) - Tuesday, 21 June 2011, 18:34 GMT+3

BTW I note that I chose Image 0 in Picture Editor | Images in File and got

GUICtrlSetImage(-1, "D:\WINDOWS\system32\shell32.dll", -1)

Should Images in File be 1-based?

Comment by Admin (Lazycat) - Thursday, 23 June 2011, 10:34 GMT+3
BTW I note that I chose Image 0 in Picture Editor | Images in File and got

This is correct. Koda not parsing resource names, and refer icons by index only. So, in Autoit, with "negative 1-based index", actual icon indexes will be:

0 → -1
1 → -2
etc.

Using

GUICtrlSetImage(-1, "D:\WINDOWS\system32\shell32.dll", "1")

instead

GUICtrlSetImage(-1, "D:\WINDOWS\system32\shell32.dll", -1)

not quite correct, since literal name of resource can be anything, and passing string "1" you can get empty icon.

In any case, this is looks like a bug in Autoit's Button implementation, since GUICtrlSetImage work fine with Icon and TreeView.

Comment by Chris Haslam (c.haslam) - Thursday, 23 June 2011, 16:47 GMT+3

So should the Koda doc for Picture Editor say: "Due to a deficiency in AutoIt, it is not possible to use the first icon in an icon .dll file" ?

Is there really no work-around?

not quite correct, since literal name of resource can be anything, and passing string "1" you can get empty icon.

Is the literal name of the first icon in shell32.dll actually "1"?

Is it possible to implement the following logic:

  • If an icon has a name, use it in calling GuiCtrlSetImage
  • Else use its ordinal number in quotes in calling GuiCtrlSetImage ?

BTW I used your enumicons.au3 (from the AutoIt distribution) in my sleuthing. Thank you.

Comment by Admin (Lazycat) - Friday, 24 June 2011, 15:37 GMT+3

I think we can use numeric 0 in case where should be -1. While it wrong, it's should work. I don't want messing with names.

BTW, enumicons.au3 in Autoit package is incorrectly working with resource names. I once did the right version, it was placed in distribution, but later Jon removed it with the reason "it's too complex for example". While that right, bundled version get wrong example of working with literal names.

Correct version is here. And this topic just for the story.

Comment by Chris Haslam (c.haslam) - Friday, 24 June 2011, 23:50 GMT+3

Thanks.

Loading...