Cgfxoutbarctrl's Bug article

Source: Internet
Author: User
Tags knowledge base

I am a VC + + beginners, calculate up to less than four months, but I almost every day to visit the VC Knowledge Base website, I am a bit of interface enthusiasts, on the site of the new controls are all the feeling. VC Knowledge Base website recently published a imitation Outlook interface class Cgfxoutbarctrl I downloaded some problems, feel that these small problems have a little impact on the overall appearance of the interface, generous, so I would like to contribute to improve the Cgfxoutbarctrl of all the code.

First, the question of the proposed

Let's now list all the problems that exist in Cgfxoutbarctrl, and then we'll solve them one by one:

1. If you delete a non-Treebar directory, you will see the following figure:

2. Deleting the Treebar directory will appear as shown in the following illustration:

3. In addition Cgfxoutbarctrl provides us with the right button menu is "Birds of the bird", we must carry out "Chinese" work.

So then let's one by one solve these problems.

Ii. solution to the problem

1. Problem 1 occurs because the Cgfxoutbarctrl view area has not been refreshed after the directory (folder) is removed. Viewing the Removefolder function in file GfxOutBarCtrl.cpp does not know that it did not take the active refresh operation after the directory was deleted, but instead passively waits for Windows refresh notification. So let's take the initiative to send a notification message to the view area to refresh (repaint) operation! I just started with SendMessage to Cgfxoutbarctrl send wm_size message to let the view area refresh, but then I ran n many times suddenly found the original situation again, so I studied the structure of the Cgfxoutbarctrl class, found that when the user changes the current directory (folder), the Cgfxoutbarctrl class will be active to refresh the redraw view area, so we do not need to write the extra code only to be active to call the function: Setselfolder () can.

2. Problem 2 occurs because the Cgfxoutbarctrl class only deletes the Cbarfolder class member object in the Removefolder function. Instead of removing the CTreeCtrl class member object that the CTreeCtrl class pointer in the Cbarfolder class points to. That's why the directory is deleted, but the actual CTreeCtrl class object still exists. Then we just need to add the code to release the CTreeCtrl object in the Removefolder function.

Then the modified Removefolder function code is as follows: (Add the black part for the code I added)

void Cgfxoutbarctrl::removefolder (const int index)
{
ASSERT (index >= 0 && Index < Getfolde Rcount ());
Cbarfolder * PBF = (Cbarfolder *) Arfolder.getat (index);
//modified by Blue Sky workroom
//author:lixiaofei date:2003y-01m-14d::11:15
//The original program does not release the subform space in the folder causes the display to be mixed  Chaos.
if (pbf->pchild)
{
:: SendMessage (Pbf->pchild->m_hwnd, wm_close, 0, 0);
//equivalent to: Pbf->pchild->destroywindow ();  
}
Delete PBF
Arfolder.removeat (index);
if (iselfolder >= index) Iselfolder = index-1;
if (Iselfolder < 0 && getfoldercount () > 0) iselfolder = 0;
//modified by Blue Sky workroom
//author:lixiaofei date:2003y-01m-14d::11:35
//The original program did not update the view area after deleting the subform, causing the catalog to display Chaos.  
//WORKAROUND:
//Set the current page manually: Setselfolder (iselfolder);
    Setselfolder (Iselfolder);
Invalidate ();
}

3. Cgfxoutbarctrl right Key menu of the Chinese problem in fact, only need to modify the GfxOutBarCtrl.cpp file in a few #define can. Modified as follows:

//汉化工作
#define _ID_GFX_SMALLICON    "小图标风格"
#define _ID_GFX_LARGEICON    "大图标风格"
//
#define _ID_GFX_REMOVEITEM  "删除子项"
#define _ID_GFX_RENAMEITEM  "子项重命名"

OK, about the problems existing in the Cgfxoutbarctrl Class I will first say here, if you have in the future use of the process also found Cgfxoutbarctrl bug, you can write to lixiaofei@geasp.com tell me, thank you! Thank you again the VC Knowledge Base provides the exchange opportunity for us.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.