xj qian
2024-07-02 c34f5ae522756455f43b749684387c98ec1b03e5
update face
已添加1个文件
已修改1个文件
230 ■■■■■ 文件已修改
jrj/ext-jrj/ext-jrj.vcxproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/vindexformex.cpp 229 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/ext-jrj/ext-jrj.vcxproj
@@ -397,6 +397,7 @@
    <ClCompile Include="..\project\start.vframe.vbusiness.cpp" />
    <ClCompile Include="..\project\viewobject\view.base.hpp" />
    <ClCompile Include="..\project\vindexform.cpp" />
    <ClCompile Include="..\project\vindexformex.cpp" />
    <ClCompile Include="..\project\vindexmenu.cpp" />
    <ClCompile Include="..\project\workflow\workflow.actionlog.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
jrj/project/vindexformex.cpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,229 @@

#pragma once
#include "xcontrol/xdwtable.hpp"
#include "xcontrol/xdwgrid.hpp"
#include "wobject/xwin.hpp"
#include "wobject/xstring.hpp"
#include "wobject/xaserverarg.hpp"
#include "wobject/xaserver.hpp"
#include "xcontrol/xcombobox.hpp"
#include "xcontrol/xlayersheet.hpp"
class __declspec(dllexport) vindexformex: public xwin
{
public:
    string m_Assignment;
    HWND m_hMenu;
    xlayersheet mainsheet;
    xcombobox cbx_menu;
    xcombobox cbx_panelName;
    xcombobox cbx_panelNo;
    xcombobox cbx_tab;
public:
    vindexformex(void* implPtr,HWND hWnd):xwin(implPtr,hWnd){}
public:
    static vindexformex * CreateInstance(void* implPtr,void* hWnd)
    {
        return  new vindexformex(implPtr,(HWND)hWnd);
    }
    string getHomeConfig(string att)
    {
        xml x = new xml;
        x.setNativePointer(xml::CreateInstance());
        x.Load("cache\\config.xml");
        //alert(x.GetXml());
        if (x.GetXml() == "") return "";
        msxml::IXMLDOMElement e = x.GetXmlDoc().documentElement;
        if (e.selectSingleNode("home"))
        {
            msxml::IXMLDOMElement e1 = e.selectSingleNode("home");
            if (e1.selectSingleNode("@" + att))
                return e1.selectSingleNode("@" + att).text;
        }
        return "";
    }
    int setHomeConfig(string att, string value)
    {
        xml x = new xml;
        x.setNativePointer(xml::CreateInstance());
        x.Load("cache\\config.xml");
        if (x.GetXml() == "")
        {
            //alert("<config><home "+att+"="+value+"/></config>");
            x.LoadXml("<config><home " + att + "='" + value + "'/></config>");
        }
        else
        {
            msxml::IXMLDOMElement e = x.GetXmlDoc().documentElement;
            if (e.selectSingleNode("home"))
            {
                msxml::IXMLDOMElement e1 = e.selectSingleNode("home");
                e1.setAttribute(att, value);
            }
            else
            {
                msxml::IXMLDOMElement e2 = x.GetXmlDoc().createElement("home");
                e2.setAttribute(att, value);
                e.appendChild(e2);
            }
            //alert(e.xml);
        }
        //alert(x.GetXml());
        xutil::SaveToFile("cache\\config.xml", x.GetXml(), "", "", "");
        return 1;
    }
public:
    int OnDWClick(TEvent* evt, int p)
    {
        alert(L"clicked");
        return 1;
    }
    int OnMenu(HWND hMenu)
    {
        if (!hMenu)
        {
            HWND hw = m_hMenu;
            bool f = IsWindow(hw);
            if (hw == 0 && f <= 0)
            {
                xaserverarg* arg = new xaserverarg();
                HWND hWnd = GetHWND();
                arg->SetParam(L"hwnd", (LPARAM)hWnd);
                arg->SetParam(L"memuId", (LPARAM)cbx_menu.getNativePointer());
                arg->SetParam(L"tabNo", (LPARAM)cbx_tab.getNativePointer());
                arg->SetParam(L"panelNo", (LPARAM)cbx_panelNo.getNativePointer());
                arg->SetParam(L"panelName", (LPARAM)cbx_panelName.getNativePointer());
                xwin* pwin=OpenWindow(L"dev:xpage[vindexmenu.vx]", (LPARAM)arg);
                m_hMenu = pwin->GetHWND();
                hw = m_hMenu;
                //return 1;
            }
            HWND HWND_TOPMOST = (HWND) - 1;
            HWND HWND_NOTOPMOST =(HWND)-2;
            int SWP_NOSIZE = 0x0001;
            int SWP_NOMOVE = 0x0002;
            int SWP_SHOWWINDOW = 0x0040;
            SetWindowPos(hw, HWND_TOPMOST, -1000, -1000, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
        }
        else
        {
            m_hMenu = hMenu;
        }
        xrect xr;
        xcontrol xc = GetControl(L"xmMenu");
        GetWindowRect(xc.GetHWND(), xr);
        int l = xr.left;
        int b = xr.bottom;
        xrect r;
        xc = GetControl(L"split");
        GetWindowRect(xc.GetHWND(), r);
        int t2 = r.top;
        int b2 = r.bottom;
        MoveWindow(m_hMenu, l - 7, b, 220, b2 - t2, true);
        return 1;
    }
    int OnCmdDispatch(xstring comdid)
    {
        if (comdid == L"xmMenu") OnMenu(0);
        //else if (comdid.find(L"menuid:", 0) >= 0)
        //    return OnMenu((HWND)comdid.mid(comdid.find(L":", 0) + 1, comdid.length()).toInt());
#if 0
        if (comdid ==L "xmAssignment") OnChangeLogin();
        else if (comdid == L"xmAllCaption") OnAllCaption();
        else if (comdid == L"xmMenu") OnMenu(L"");
        else if (comdid == L"xmHelp") return OnHelp();
        else if (comdid.find("menuid:", 0) >= 0) OnMenu(comdid.mid(comdid.find(":", 0) + 1, comdid.length()));
        else if (comdid.find("menuAgent:", 0) >= 0) OnMenuAgent(comdid.mid(comdid.find(":", 0) + 1, comdid.length()));
        else if (comdid.find("changesheet:", 0) >= 0) OnChangeSheet(comdid.mid(comdid.find(":", 0) + 1, comdid.length()));
        else if (comdid.find("openforoldid:", 0) >= 0) OnOpenForOld(comdid.mid(comdid.find(":", 0) + 1, comdid.length()));
        else if (comdid.find("open:", 0) >= 0) OnOpen(comdid.mid(comdid.find(":", 0) + 1, comdid.length()));
        else if (comdid == "xmRefreshTask")
        {
            SendMessage(m_startwin, 0x401, comdid, 0);
            return 1;
        }
#endif
        return 0;
    }
    int OnXCommand(TEvent* evt,int p)
    {
        return OnCmdDispatch(evt->xcommand.pStrID);
    }
    int OnAttachListon()
    {
        AttachEvent(L"WM_XCOMMAND",(FEvent)&vindexformex::OnXCommand,this);
        //AttachEvent("mdilayer", "LYSN_SELECTEDSHEET",OnSheetChanged);
        ////AttachEvent("mdilayer", "LYSN_CLOSESHEET",OnCloseSheet);
        return 1;
    }
    int SetUserID()
    {
        Hxsoft::XFrame::KXMLDOMDocument x;
        xaserverarg arg;
        arg.AddArg(L"Assignment", m_Assignment);
        if(xaserver::ExecXQuery(GetServerUrl(),L"[GetSysInfo.xq]",arg.GetString(),x)!=1)
        {
            trace(x.xml());
            return -1;
        }
        if((xstring)x.xml() == L"") return -1;
        Hxsoft::XFrame::KXMLDOMElement e = x.documentElement();
        if((xstring)m_Assignment == L"" && e.selectSingleNode(L"AssignmentID"))
        {
            string sInfoEx = e.selectSingleNode(L"AssignmentID").text();
            m_Assignment = sInfoEx;
        }
        if((xstring)m_Assignment == L"")
            alert(L"获取用户数据失败,请重新登录!");
        else
            xaserver::SetUID((LPWSTR)m_Assignment);
        return 1;
    }
    int Initial()
    {
        SetUserID();
        return 1;
    }
    int onload()
    {
        m_hMenu = 0;
        m_Assignment = L"";
        mainsheet = GetControl(L"mdilayer");
        cbx_menu = GetControl(L"memuId");
        cbx_tab = GetControl(L"tabNo");
        cbx_panelNo = GetControl(L"panelNo");
        cbx_panelName = GetControl(L"panelName");
        Initial();
        OnAttachListon();
        OpenWindow(L"dev:xpage[start.vframe.vbusiness.vx]");
        return 1;
    }
};