PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → Simulate a click on first table row after click on table header
Simulate a click on first table row after click on table header
Débuté par George, 20 oct. 2014 18:47 - 7 réponses
Posté le 20 octobre 2014 - 18:47
Hi Forum,
Would be possible, after click on table header and table being sorted for that column, simulate a click on first table row?
I did try by inserting code in different sections of table's code, as well by intercepting the event, but that is not working.
Thanks in advance for your suggestion

Regards,

George
Posté le 21 octobre 2014 - 20:36
Hi George,

In stead of a 'click' you can use 'left button down' from the 'Optional processes' of the table.

Suggestion: put your desired action in a procedure and call that procedure from within 'left button down' for normal usage. Then, after the sort, you select in your code the first row with TableSelectPlus and call the same procedure.

Or did you mean something else?
Kind regards,
Rudolf van Roosmalen
Posté le 22 octobre 2014 - 06:21
Thanks Rudolf for your answer.

Here is a more detailed explanation of my issue:

1. I have two tables (browsers) where in the second table a query is executed in accordance to information displayed in first table. When I select a row in the first table, the information linked in the second table is displayed correctly.

2. However when the user click in the header of the first table column although this first table display the sort correctly, and the focus is in the first row, the second table is not updated and wrong information, not linked to first table, is displayed.
I need to do a click in first row of the the first table in order update the second table.

Regards,

George
Posté le 22 octobre 2014 - 09:40
Hi George,

Actually, as far as I can see you do not need 'a click' in the first row, you just need to execute code (query) like when you click in the first row. As you described you have tried some different events I suspect you do not use the linking by RAD, but actually use some code.

Can you implement the suggestion to put the code of the 'click' in a seperate procedure and call that procedure from
1) within the click (for normal use) = "Left button up"
2) after the sort?

By the way, about the click the Help for TableInfoXY describes:
"To use MouseXPos and MouseYPos in the X and Y parameters of the function, make sure that a single mouse click will trigger the execution of the code containing this function.
For example, the "Table row selection" process can be started by a mouse click but also by a keyboard selection. Therefore, MouseXPos and MouseYPos should not be used in this process. Use an optional process instead. In this example, use the "Click a table row (Left button up)" process."

Note: you can put the mousepointer on the first row by 'CursorPos' and after the 'click' return to the place it was (by memorizing that position before you use the first time CursorPos).

I hope this can put you on the best of your two good feet,
Kind regards,
Rudolf
Posté le 22 octobre 2014 - 12:34
Hi George

actually, you do not need to do a click, yo need to execute the code of
the line selection in the first table, and for that, you should do an
Executeprocess (tableName, SelectTheRightOptionHere)

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

NEW: WXReplication, your open source replication system is available on
my web site!!!
WXShowroom.com: Show your projects!
More information on http://www.fabriceharari.com



n 10/21/2014 10:21 PM, George wrote:
Thanks Rudolf for your answer.

Here is a more detailed explanation of my issue:

1. I have two tables (browsers) where in the second table a query is
executed in accordance to information displayed in first table. When I
select a row in the first table, the information linked in the second
table is displayed correctly.

2. However when the user click in the header of the first table column
although this first table display the sort correctly, and the focus is
in the first row, the second table is not updated and wrong
information, not linked to first table, is displayed. I need to do a
click in first row of the the first table in order update the second table.
Regards,

George
Posté le 23 octobre 2014 - 02:34
Thanks Rudolf and Fabrice for your help
I did implement the solution suggested by Rudolf and it's working fine regarding that now is displaying, after the sorting, the correct information in the second browser.
Now I need only to position the record in the first browser on selected row that is linked to the second table.
I mean, in a 20,000 record database in first table, after the sorting the first row displayed now is a new row in according to the sorting, but the record with the focus (the record that is linked to the information displayed in second table) can not be seen in the computer screen as this record could be now in first table in row number 3000.

I did try to solve with tableseek() and tableselectplus(), but this is not working because after the sorting, the rows position in the first table are changed.

Would be possible to search a column in a table, as we do with a field in a file? I mean something similar to HreadSeekFirst()
If this is not possible I think the solution would be to create a new query after the sorting but this would be inefficient.

Regards,

George
Posté le 23 octobre 2014 - 10:30
Hi George,

TableSeek does a 'seek' in any column you define.
"<Result> = TableSeek(<Column Name> , <Sought Element> [, <Type of Search> [, <Source Row>]])"

To 'link' memorytables in a way I can control myself I usually create an invisible column with an unique identifier in one table, matching the same invisible identifier(s) in the other table.

Normally, when I need to use two tables, one is for the headers and one is for the details. In those cases (when I expect a user will click multiple times on different items in the header table) I fire one big query for the details and fill that second table with tableaddline, depending of which headerline the user did click. The big query keeps his results till you destroy it, so you only have to fire it one time.

(Yes, despite a lot of nice stuff to let WinDev handle things I still tend to do a lot by code as that permits me to control the flow and still I deny being a control-freak.)

With kind regards,
Rudolf
Posté le 23 octobre 2014 - 14:36
Understood Rudolf.
I will try your suggestion as I never use RAD.

Best regards,

George