1

1) I try to load ico image to IUPbutton but with no success.
After linking IM dll's and add proper header this is my approach:

Ihandle *btn1, *btn2;
Ihandle* img1;

btn1 = IupButton("", NULL);
IupSetAttribute(btn1, "MINSIZE", "24x24");
btn2 = IupButton("", NULL);
IupSetAttribute(btn2, "MINSIZE", "24x24");

img1 = IupImage(16, 16, IupLoadImage("icons\\home_16x16.ico"));
IupSetAttribute(btn1, "IMAGE", "img1");

frame = IupHbox(btn1, btn2, NULL);
dlg = IupDialog(IupHbox(mat, IupVbox(frame, tree, NULL), NULL));

IUP don't report any error but image don't appear on the button btn1.
How to load picture from file to a button in RGBA mode?

2) I fill IupTree with data from sqlite database in following order: 'Name' (which is root) and then about 170 branches which have 1-10 leafs. VALUE is set to 0 and 'Name' is selected.
How can I get with code expanded tree to first branches like when I doubleclick to 'Name'?
I try EXPANDALL attribute but then all leaf's are expanded too what is not wanted.

3) How can I get IUPtree item 'id' in k_any callback f. e. when press ENTER key?

4) How can I get IUPtree item text from 'id' in executeleaf and branchopen callbacks?

5) How can I loop through IUPtree to get id, text, sort of item (branch/leaf)?

6) Is here a way on IUPmatrix to catch keyUP or keyRELEASED event like we get keyPRESS in K_ANY?

4

1 回答 1

2

1)更加注意每个函数的数据类型。请注意,IupLoadImage 已经返回一个 Ihandle。所以而不是:

img1 = IupImage(16, 16, IupLoadImage("icons\\home_16x16.ico"));

你应该做这个:

img1 = IupLoadImage("icons\\home_16x16.ico");

此外,如果你这样做:

IupSetAttribute(btn1, "IMAGE", "img1");

您正在指定一个字符串,您必须以某种方式将字符串“img1”关联到 Ihandle img1。它们是两个非常不同的东西。检查 IupImage 文档。或者你这样做:

IupSetHandle("img1", img1);
IupSetAttribute(btn1, "IMAGE", "img1");

或者更好的方法:

IupSetAttributeHandle(btn1, "IMAGE", img1);

2)您是否尝试仅扩展您想要扩展的分支?检查 IupTree 文档中的 STATEid 属性。

3)您想要的是具有焦点的项目。所以获取IupTree的VALUE属性。请注意,Enter 键将触发已经具有项目 ID 的 executeleaf 回调。

4) 检查文档中的 TITLEid 属性。

5) 提示,在设置/获取 IupTree、IupMatrix 或 IupList 的属性时,您可以使用:

IupSetAttribute(ih, "TITLE3", "My Title");
  or
IupSetAttributeId(ih, "TITLE", 3, "My Title");

6) 正如我之前告诉你的,IupMatrix 继承自 IupCanvas,所以你还必须检查 IupCanvas 回调。检查 IupMatrix 回调文档,最后有关于 IupCanvas 回调的解释。

于 2013-04-22T13:31:43.863 回答