Plex 2E

Expand all | Collapse all

Reaching grid column visibility at run time

  • 1.  Reaching grid column visibility at run time

    Posted 05-25-2009 03:27 AM
    Hi allDo you know a way to get the runtime status for a grid column?   (WinC variant) I want to know if a grid column is visible or not. Given that I will use it for a generic pattern, I don ´t have ways to know if a given grid field is visible or not,  nor if it exists or not  (there aren ´t ways to ask the model on panel/grid properties, as long metaoperations ask for triples). Discarded generation time querying, I ´m thinking to ask at run time. Reviewing Microsoft Visual Studio reference without positive results yet...TIA


  • 2.  Re: Reaching grid column visibility at run time

    Posted 06-02-2009 07:23 AM
    Two cents more...Looking the c++ code, I can see that grid initialization uses the resource data to set the control state:  // Call   Uibasic/Meta.InitInputRegion
    // Comment   Copyright © 1994-1998 by Sterling Software, Inc. All Rights Reserved.
    // Comment   Initialize the fields for a region.
    // Comment   Enclose this in a field defining meta loop.// Set   GridP to empty   { ++Set Empty }
                          v->Variable_5.ZCOMER.SetEmpty(); // Set   GridP = state   { ++Set State   Default }
                          pnl->HEdit_159 -> SetState(12295); /* Zona Comercial */  Where at the RC file:     /* State: Zona Comercial, 1 */
          12295 , "\0017:MS Sans Serif, -11, N\0016:0x80000005\0015:0x80000008\0014:Zona Comercial\ 0013:0 , 20\0012:184, 56\0011:6\0018:0x00000000"  the field column lenghth is set to 0  Here is my question:Looking at the Widgets.h, there are a number of constants that seems to be related to grid handling:  #define HGRM_GETHIDDENDATA       (HGM_FIRST + 92) // MCS Grid Overhaul
    #define HGRM_SETHIDDENDATA       (HGM_FIRST + 93) // MCS Grid Overhaul#define HGRM_GETSTATE                         (HGM_FIRST + 80)
    #define HGRM_SETSTATE                         (HGM_FIRST + 81)
    #define HGRM_GETDATA                           (HGM_FIRST + 82)
    #define HGRM_SETDATA                           (HGM_FIRST + 83)  ...& other...then, there are some documented api to do a sort of "getState()", or "getColumnLen()"?  Thanks in advanceJorge Ubeda


  • 3.  Re: Reaching grid column visibility at run time

    Posted 07-17-2009 03:49 PM
    Hi Jorge,  Try this,  // *****************************************************************************************************  CWnd pWnd = ObPanelAPI::GetPanelCWndByName("Current");HWND hGrid = ObPanelAPI::GetControlHandleByName(&(1:));
     if(hGrid) {
    WORD wState = SendMessage(hGrid,HGFM_GETSTATE,&(2:) ,0L);if(wState != 5)
    {
    SendMessage(hGrid,HGFM_SETSTATE, &(2:) , MAKELONG(  &(3:)   , HGFF_HIDDEN));
    }
    else
    {
    SendMessage(hGrid,HGFM_SETSTATE, &(2:) , MAKELONG(  &(3:)   , HGFF_HIDDEN));
    }
    SendMessage(hGrid, HGM_UPDATE, 0, 0);
    //
    }  pWnd->Invalidate(TRUE);
     pWnd->UpdateWindow();  // *****************************************************************************************************  where&(1:) = Control name of grid from panel designer.&(2:) = Column number&(3:) = Show=0/Hide=1    The above works based on column number, if you like to compare by column name then HGM_GETCOLMAP & HGFM_GETNAME could be used.  RegardsAshfaq


  • 4.  Re: Reaching grid column visibility at run time

    Posted 07-17-2009 09:21 PM
    Hi Ashfaq,Thanks for you suggestion. I have a week to think about you solution. I ´m just on vacation for a week...By the way, I have solved this issue at design time, but It is a problem that I want to catch.With kind regardsJorge Ubeda