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?
1) Pay more attention to the data type of each function. Notice that IupLoadImage already returns an Ihandle. So instead of:
img1 = IupImage(16, 16, IupLoadImage("icons\\home_16x16.ico"));
you should do this:
img1 = IupLoadImage("icons\\home_16x16.ico");
Also if you do this:
IupSetAttribute(btn1, "IMAGE", "img1");
you are specifying a string, you must somehow associate the string "img1" to the Ihandle img1. They are two very different things. Check the IupImage documentation. Or you do:
IupSetHandle("img1", img1);
IupSetAttribute(btn1, "IMAGE", "img1");
Or a better way:
IupSetAttributeHandle(btn1, "IMAGE", img1);
2) Have you try to expand only the branch you want expanded? Check the STATEid attribute on the IupTree documentation.
3) What you want is to the the item that has the focus. So get the VALUE attribute of the IupTree. Notice that the Enter key will trigger the executeleaf callback which already has the item id.
4) Check the TITLEid attribute in the documentation.
5) A tip, when setting/getting attributes of a IupTree, IupMatrix or IupList, you can use:
IupSetAttribute(ih, "TITLE3", "My Title");
or
IupSetAttributeId(ih, "TITLE", 3, "My Title");
6) As I told you before, IupMatrix inherits from IupCanvas, so you must also check for the IupCanvas callbacks. Check the IupMatrix callbacks documentation, at the end there is an explanation about the IupCanvas callbacks.