Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community

At 13 FEB 2020 11:39:37PM Dave Sigafoos wrote:

Using the document found at https://revdevx.com/2015/09/26/sorting-in-edittables/

I would think that the following code would work correctly. It Sorts but the shiftkey bit does not change the sort order


Declare Function Get_Property

Declare Subroutine Exec_Method

Equ NULL$ To ""



ColRow = Get_Property(ctrlEntId,"NOTIFYPOS")

row = ColRow<2> ; col = ColRow<1>

sortOptions = NULL$

sortCriteria = NULL$ ; sortCriteria<1,1,1> = col

* change sort order if shift key is pressed

If ShiftKey Then sortCriteria<1,1,2> = 1



Call Exec_Method( CtrlEntID, "SORT", SortCriteria, SortOptions )



return 1


At 13 FEB 2020 11:46PM Dave Sigafoos wrote:

actually this line

If ShiftKey Then sortCriteria<1,1,2> = 1

should be ..

If ShiftKey Then sortCriteria<1,2,1> = 1

But even at that … the little arrow changes direction but the data doesn't change


At 14 FEB 2020 06:26PM Dave Sigafoos wrote:

Can someone please try this and let me know where I went wrong. I doubt that the article

is wrong … Carl doesn't make mistakes. He leaves that for me :)


At 14 FEB 2020 08:31PM Carl Pates wrote:

Ha - if only that were true :)

Are you wanting to toggle the sort order or force it to Ascending Left?

Setting <0,2> always sets a specific order, so if you're setting it to "1" you will always sort "Ascending Left" - it won't "toggle" to "Descending Left" instead automatically.

You can "toggle" if you use the COLHEADERSORTINGMODE property, but that doesn't use a shift key, it just works on column header clicks/dblclks

What is it that you actually need to do?

Cheers

Carl Pates


At 15 FEB 2020 11:11AM Dave Sigafoos wrote:

so what the original code did was (this is also for the send_message topic) get the row/column that was clicked (notifyPos does this nicely) then sort the table either descending (dclick) or ascending (shift dclick). SO I am trying to duplicate this with the code. But when I use the code above it does not change sort order. It does the first sort (dclick) but ignores the second sort EXCEPT the little sort arrows change.


At 15 FEB 2020 11:11AM Dave Sigafoos wrote:

so what the original code did was (this is also for the send_message topic) get the row/column that was clicked (notifyPos does this nicely) then sort the table either descending (dclick) or ascending (shift dclick). SO I am trying to duplicate this with the code. But when I use the code above it does not change sort order. It does the first sort (dclick) but ignores the second sort EXCEPT the little sort arrows change.


At 17 FEB 2020 02:08PM Dave Sigafoos wrote:

Carl, i have sent you a copy of the original code so you can see what I am trying to achieve ..


At 18 FEB 2020 05:31AM Carl Pates wrote:

Hi Dave,

Using the CellDblCk event something like this should do what you need:


   // Is it the col header row?

   if ( rowNum == 0 ) then



      // Is it a data column?

      if ( colNum > 0 ) then

         

         sortCrit = ""

         sortCrit<0,1> = colNum

         sortCrit<0,2> = ( if shiftKey then 1 else 0 )



         call exec_Method( ctrlEntID, "SORT", sortCrit, 0 )

         

      end

   end

Carl Pates


At 18 FEB 2020 10:40AM Dave Sigafoos wrote:

I think it was this line that was missing from mine and I can't find it mentioned in your article ..

call exec_Method( ctrlEntID, "SORT", sortCrit, 0 )

Thanks a lot ..


At 18 FEB 2020 10:58AM Carl Pates wrote:

Hi Dave,

Its documented in the section titled The Sort Method, but there's no code example as such.

Cheers

Carl Pates


At 18 FEB 2020 11:08AM Dave Sigafoos wrote:

thanks again .. sorry i took so much of your time.


At 18 FEB 2020 11:13AM Carl Pates wrote:

Not a problem, but you might owe me a JD when I see you again :)

Carl Pates


At 18 FEB 2020 12:04PM Dave Sigafoos wrote:

  • third_party_content/community/commentary/forums_works/fa6fc14515d86c49a187949e0a34dfa8.txt
  • Last modified: 2024/01/04 20:57
  • by 127.0.0.1