Search code examples
iup

IUP, menu, webbrowser, tree, tabs


I have such menu situation:

int menu_create(Ihandle *menu)
{
hamburger = IupItem("&Hamburger", "hamburger");
IupSetAttributes(hamburger, "AUTOTOGGLE=YES, RADIO=YES");

char* ce = "Ćev&apčići";
cevapcici = IupItem(utf8_to_cp1250(ce), "cevapcici");
IupSetAttributes(cevapcici, "AUTOTOGGLE=YES, RADIO=YES");

exit = IupItem("Exit\tAlt+F4", "exit");
img4 = IupLoadImage("icons\\delete_16x16.ico");
IupSetAttributeHandle(exit, "TITLEIMAGE", img4);

menu = IupMenu(
       IupSubmenu("File",
          IupMenu(
             hamburger,
             cevapcici,
             IupSeparator(),
             IupItem("Carro&t", "carrot"),
             IupSeparator(),
             exit,
             NULL)),
       NULL);

      IupSetFunction("exit", (Icallback)mnu_exit);
      ... etc...

  IupSetHandle("menu", menu);
return IUP_DEFAULT;
}

How to get "radio toggle group" functionality with items hamburger and cevapcici so first turns off a second checkmark and opposite. This is my try but it don't work.

2) I try webbrowser example from IUP suite on my windows 7. Problem is that bad black flickering appear's during resize (increase). Also, background of webbrowser flicker black during showing. I try a same example on Ubuntu and there flickering appear's too but it is not so much visible since background is there white. Is here any way to get rid of those flickering or if not to get white background of webbrowser window on windows?

3) Since webbrowser is ole object (on windows) is it possible to use say "print preview" or "zoom" function by reference from IUP handle or at any other way like we used to do from MS programming tools?

wbInstance.ExecWB(Exec.OLECMDID_OPTICAL_ZOOM, ExecOpt.OLECMDEXECOPT_DONTPROMPTUSER, 150, DBNull.Value)

4) How can I get key_up event fired from IupTree?

5) Interesting situation with IupTabs:

frame3 = IupHbox(mat, val, NULL);

vboxt1 = IupVbox(frame3, NULL);
vboxt2 = IupVbox(frame3, NULL);
IupSetAttribute(vboxt1, "TABTITLE", "First documents... ");
IupSetAttribute(vboxt2, "TABTITLE", "Second documents... ");
tabs = IupTabs(vboxt1, vboxt2, NULL);

hbox1 = IupHbox(tabs, IupVbox(frame, tree, frame2, NULL), NULL);

dlg = IupDialog(hbox1);

When I set frame3 which should be a same for both tabs my GUI frozes. However, I have to got same "mat" (IupMatrix) in both tabs because by changing tabs other data load in matrix but similar enough to use same matrix and related functions.

What to do here?


Solution

  • 1) The RADIO attribute belongs to the IupMenu, not to the IupItem. This also means that all the IupItems inside that menu will be part of the radio.

    A workaround would be to manually unset the other toggle inside the action callback.

    2) That flicker is not caused by IUP. Don't know why the native controls are doing it.

    3) Yes, but you will have to program that using the OLE API. If you take a look at the IupOleControl and IupWebBrower source code and send me the code to do it, I will be happy to add it to IUP.

    4) You don't. Use the K_ANY callbacks.

    5) You can not reuse a control in different places in any dialog. So you must have two different frames, with two different matrices. What you can do is to encapsulate your matrix, so the same function will create a matrix with the same attributes and callbacks any time you want one.