Is there a WinC api function for getting information about which columns are used to sort a grid and what direction is used? I know of the WINAPI function SortGrid, but it seems that there is not a function for getting current sort settings.
My scenario: I would like to run Reload grid for a grid, but retain the current ordering.
dynamic column sort see my answers
You up against winwidgets so you can always look at http://wiki.plexinfo.net/index.php?title=WinWidgets . I have for you and in the help there is no reference to determining if a column has or has not be sorted and if so ascending or descending.
BUT that does not mean winwidgets does not support it as in WIDGETS.H in your CA Plex Headers folder you will see the following:
// Grid Sorting
#define HGM_SORTGRID (HGM_FIRST + 133)
#define HGM_SETGRIDSORTMODE (HGM_FIRST + 134)
#define HGM_RESORTGRID (HGM_FIRST + 135)
#define HGM_GETCURRENTSORTSTATE (HGM_FIRST + 136)
Now you could play with HGM_GETCURRENTSORTSTATE as it is not clear what it does or indeed the parameters...maybe you send in the control name and column number and it sends back sorted yes no and ascending or descending or not...i don't know with out playing..it might just tell you if a particular column can be sorted ie sorting is enabled on the coloumn
You would play around with something like the following:
if not as highlighted others
People have a hidden the column headings and used buttons instead to mimic the column headings (which are buttons) and then you have full control on the grid.
Lazy Yuk Tip: Have seen others add a hidden counter to a grid and if the order changes then some sorting has occured..
Was trying to help you for several hours but CA Plex cr!p build standard these days I could not get Source code: WINAPI/Re-SortGrid to work....Source code: WINAPI/SortGrid works. Wanted to make sure these worked before as a stable platform to look at HGM_GETCURRENTSORTSTATE
My advice is contact support and ask why WINAPI/Re-SortGrid does not work and while you are at it ask what does HGM_GETCURRENTSORTSTATE do. Good Luck
When playing with HGM_GETCURRENTSORTSTATE and using the tagSortInfo structure I found it was crashing the plex runtime which to help CA support reminded me of the problem I had with the structure in C++ Client Testing Tool Support of WinWidgets Grid
Thank you for help!
I do not yet know what solution to try, but I can report when I get my functionality implemented.
The workaround for this could be that I just update the changed row in the grid, and so I would not need to do the reloading of grid. I just don't know it is possible to handle deletion of a grid row that way.
You can delete just a row with out reloading just use the remove statement
Ok, I'll try that solution.
Thanks a lot for studying this.
No worries my pleasure, I gave up late late last night, my hacking of c++ is not good enough. I suspect it wont work but need a c++ person to confirm. Lets hope wink wink jeremy can help jstent1.1
typedef struct tagSortInfo
pretty please JeremyStent
I cannot find any documentation on this message. I can get it to call the message without fouling up the calling thread. We need CA (in the absence of the original winwidgets developers) to give us some documentation on the parameters and expected results of this windows message. (Parameters are *Object with the grid control name, then FirstSortColumn, FirstSortSeq, SecondSortColumn, SecondSortSeq, ThirdSortColumn, and ThirdSortSeq). Columns appear to be 0 based..
SORTINFO * sInfo;
HWND hwndGrid = ObPanelAPI::GetControlHandleByName(&(1:));
lr = SendMessage(hwndGrid, HGM_GETCURRENTSORTSTATE, 0, (WPARAM) &sInfo); // changing the 0 to something else seems to have no impact
// lr seems to be the number of sort columns. User clicking only ever seems to set 1. Programmatically we can set at least three.
if (lr > 0) // at least one sort column
&(2:) = sInfo.iColumnNumber;
&(3:) = sInfo.bAscending;
&(2:) = -1;
&(3:) = TRUE;
if (lr >1) // at least two sort columns
&(4:) = sInfo.iColumnNumber;
&(5:) = sInfo.bAscending;
&(4:) = -1;
&(5:) = TRUE;
if (lr > 2) // at least three sort columns, probably specified programmatically
&(6:) = sInfo.iColumnNumber;
&(7:) = sInfo.bAscending;
&(6:) = -1;
&(7:) = TRUE;
// Grid not found.
cool, I have always tried to hunt down the Winwidgets helpfile latter than v2.0. Have not tried that hard as I could always send the developers an email from their linkedin...so zero real marks for effort..infact will do as I am bored of learning java today...
I can confirm the columns are zero based and there is only 3 possible columns that can be sorted at any one time so your guess work on the parameters are a good as we could guess.
i spent hours last night and all i needed was '&' next to my pointer field! Dont know what & does differently just will add it to my hacks to try when writing c++ source code!
This was meant to be impossible according to CA in yester year so it is shame I didn't have the experience/confidence a decade ago to solve these things etc...I kinda relied/believed on everyone else....wont make the same mistake now with Outsystems/Mule etc, thanks again Jeremy and nice collaboration.
Found the founder of winwidgets and will email him to see if he has a help file lying around!
1992 – 1996 (4 years)
• Designed, developed and marketed the WinWidgets™, an extensive set of GUI components used by Windows developers around the world.• Licensed WinWidgets and other proprietary technology to Siemens, KnowledgeWare, Microsoft, Symantec, Morgan Stanley and others.• Grew a development and support organization to 6 people.
Prefacing a variable with an ampersand ('&') gets the address of the variable. With the address the functions that is called can modify the data, otherwise it can just reference the data passed in, and not change what is seen by the calling program. We pass the address to the pointer to the winwidget, and it changes the value of the pointer to point to some array. Without documentation I cannot say if we are supposed to free any memory afterwards.
There is also a concern that someone may have clicked on a column heading, and then reloaded the grid. In this case the grid might think it is sorted on that column, but it has really not since the data would be in the load order. It is also possible that someone clicked on a description, and then a status. This function call would return the status as the sort column, but would not indicate that there had been a secondary sort on the description, so if we re-applied the sort we would not sort in the same order.
It seems that using using Set and Remove statements to refresh the grid is a working solution. One question still arised: how can one add a new row to grid?
Is it something like this?
Set Grid2P = Invoices.Fetch.SingleFetch/FetchedData
Set Grid End Off Grid2P
Set Grid End On Grid2P
You need to use your action diagram palette more....... you need to sit down and look at all the Grid action diagram statements and look at plex help for all of them. When you are trying to get 'good' at plex you need to know what all the action diagram palette options are. There are not so many psedo code action diagram statements and unlike other languages it has not been expanded or advanced (shame pity etc) on so you really dont have much to learn compared with evolving languages where you never really catch up....easy to become truly expert in plex as I did as it remains constant...
You need to use the APPEND statement as you can see from the action diagram palette