Jump to content

Recommended Posts

  • Replies 220
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted

I've been watching non-GUI related posts till now ( :"> ) so I'm a bit out of the loop in this area .. but did someone say something about trayicon menus .. :(

Will we be able to change the menu on the fly? Specifically: to modify the menu depending on events at runtime?

Here's hoping :ph34r:

Posted

I'm working at the moment on GUI_HIDE and GUI_SHOW for "menus" but ONLY for MENU's, menuitem is not possible at the moment (maybe never...)

Cause there is also a problem with the 'first' keyboard-input.

At the moment there is already GUICtrlSetState() for menuitems available or did you mean something else?

...so long...

  • Administrators
Posted (edited)

I'm working at the moment on GUI_HIDE and GUI_SHOW for "menus" but ONLY for MENU's, menuitem is not possible at the moment (maybe never...)

Cause there is also a problem with the 'first' keyboard-input.

At the moment there is already GUICtrlSetState() for menuitems available or did you mean something else?

...so long...

I think he means adding and removing items from menus. Adding is easy, but at the moment as you know removing controls isn't possible due to the way they are accessed and stored (for speed). I'll change the code so that removing controls is possible and then we can see if we can sort something out for menus. I was going to make it possible to delete controls tomorrow anyway. Edited by Jon
Posted (edited)

@Jon: could you please take a look at CreateMENUITEM?

I think there is a small bug at the beginning:

...
if (nSubGlobalID == -1)
        hMenu = lpWin->hMenu;
    else 
    {
...

Maybe it should be:

...
if (nSubGlobalID == -1)
        lpCtrl->hMenu = lpWin->hMenu;
    else 
    {
...

cause hMenu alone is never used in this function.

Regards Holger :ph34r:

Edited by Holger
Posted (edited)

I saw in the changelog that you added ControlGethandle but it's not documented.

And I really would like to see the source of AutoIt3 (unstable version).

Did you or can you upload it somewhere?

Edited by SlimShady
  • Administrators
Posted (edited)

Updated with some fixes from JP and GuiCtrlDelete()

GuiCtrlDelete() works on most the functions except the tree/menu controls...

Devs:

The framework has been added so that controls can be deleted and the memory for controls is only allocated when required. Controls ID are sequential until the maximum number of controls have been created at which point IDs are recycled.

Edited by Jon
  • Administrators
Posted

Updated with some more JP bugfixes. Also fixed a GDI leak :)

The maximum number of controls per window has been raised to 4096 and each control only uses up memory when it is created ;) Yes, 4096 is a stupidly high number but as it doesn't affect performance what the hell :)

Posted (edited)

@Jon: how about this addition/change to GUICtrlDelete()?

////////////////////////////////////////////////////////////////////////////////////////////////
// CtrlDelete()
//
////////////////////////////////////////////////////////////////////////////////////////////////

int CGuiBox::CtrlDelete(int nGlobalID)
{
    int            nWinIdx, nCtrlIdx, i;

    if (GlobalIDtoCtrlIndex(nGlobalID, nWinIdx, nCtrlIdx) == false)
        return 0;                                // Control not used
    
    // Some quick access pointers
    GUIWINDOW    *lpWin    = m_Windows[nWinIdx];
    GUICONTROL    *lpCtrl    = lpWin->Ctrl[nCtrlIdx];

    switch (lpCtrl->cType)
    {
        case AUT_GUI_CONTEXTMENU:
            return 0;            // Can't delete these yet

        case AUT_GUI_MENUITEM:
        case AUT_GUI_MENU:
            if (lpCtrl->cType == AUT_GUI_MENU)
                for (i=AUT_GUI_FIRSTCONTROL;i<lpWin->nMaxCtrl;++i)
                    if (lpWin->Ctrl[i]->hMenu == lpCtrl->hMenu && lpWin->Ctrl[i]->cType == AUT_GUI_MENUITEM)
                        DeleteCtrlIndex(lpWin, i);
            
            if (!DeleteMenu(lpCtrl->hMenu,nGlobalID,MF_BYCOMMAND))
                DeleteMenu(lpWin->hMenu,nGlobalID,MF_BYCOMMAND);

            DrawMenuBar(lpWin->hWnd);
            break;

        case AUT_GUI_TREEVIEWITEM:
            SendMessage(lpCtrl->hBuddy,TVM_DELETEITEM,0,(LPARAM)(HTREEITEM)lpCtrl->hItem);
            break;

        case AUT_GUI_TREEVIEW:
            if (lpCtrl->hTvIml != NULL)
                ImageList_Destroy(lpCtrl->hTvIml);
            for (i=AUT_GUI_FIRSTCONTROL;i<lpWin->nMaxCtrl;++i)
                if (lpWin->Ctrl[i]->hBuddy == lpCtrl->hWnd && lpWin->Ctrl[i]->cType == AUT_GUI_TREEVIEWITEM)
                    DeleteCtrlIndex(lpWin, i);
            // cause treeview has normal window handle we run through
        default:
            // For controls that just need a simple DestroyWindow() on their handle

            // Delete the font
            if (lpCtrl->hFont != NULL)
                DeleteObject(lpCtrl->hFont);

            DestroyWindow(lpCtrl->hWnd);

            break;
    }

    // The control has been deleted, now delete the control structure memory
    DeleteCtrlIndex(lpWin, nCtrlIdx);

    return 1;

} // CtrlDelete()

Regards Holger :)

Edited by Holger
Posted (edited)

@jon, I have been using the controlcommand LV_ commands for while with great success, and would like to know if you could do any on the TV_ commands. I have had no problems with getting info on the listviews, but would like to see at least TV_SelectItem ItemName

Thanks.

Edited by this-is-me
Who else would I be?
  • Administrators
Posted

@jon, I have been using the controlcommand LV_ commands for while with great success, and would like to know if you could do any on the TV_ commands. I have had no problems with getting info on the listviews, but would like to see at least TV_SelectItem ItemName

Thanks.

It's planned, yeah. When, I have no idea.
Posted

@Lar, lol. If I new c++ I would certainly try to submit the code to help out on this... Can you point me to any good resources on learning it? That way others could bug me about progress on autoit as well.

Who else would I be?
Posted

Jon, I'm sure you were just waiting on somebody to ask this...

How about setting up events for the built-in events like closing and minimizing? GuiSetOnEvent($GUI_EVENT_ID, "function"), perhaps?

Posted

I think he means adding and removing items from menus.  Adding is easy, but at the moment as you know removing controls isn't possible due to the way they are accessed and stored (for speed).  I'll change the code so that removing controls is possible and then we can see if we can sort something out for menus.  I was going to make it possible to delete controls tomorrow anyway.

<{POST_SNAPBACK}>

Here's what I was thinking in more detail ... Tray Icon Interface

:)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...