PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → Navigation inside Table control---WD20
Navigation inside Table control---WD20
Débuté par Sara Joy, 02 mai 2016 09:19 - 13 réponses
Posté le 02 mai 2016 - 09:19
Hi all,

I have created a table with selection criteria as "Single cell only" ( Rows: No selection Columns :No selection)..Navigation of Table cells using Keyboard Arrow keys works perfect for left, right ,up, and down..

Whenever i made one column invisible,,the navigation get stucked with the invisible cell..No further navigation is possible as it get selected the invisible cell..

Highly appreciated if anyone knows the solution..Thanks in advance
[attachment 1958 22.jpg]
Posté le 02 mai 2016 - 11:11
Hi Sara,

have you tried to make the invisible column also state=inactive or state=grayed?
Posté le 02 mai 2016 - 13:08
Hi Stefan

It makes no change ...Thanks for the reply


Regards
Posté le 02 mai 2016 - 19:01
Hello Sara

Is there any code in the table or in the invisible column that is being triggered by the key strokes ?
Try it with the debugger running.

Regards
Al
Posté le 03 mai 2016 - 09:25
Hi,,

Even not a single line of code present in the invisible column...

Anyone can try this without spending much time...
.
Can anybody confirm is it a problem with PC-Soft ? plz

Regards

Sara
Posté le 04 mai 2016 - 07:44
Hi all,

Have a nice day...Any idea to solve this problem??

It would be a great help if anyone suggests a solution..

Looking forward..

Regards ,

Sara
Posté le 04 mai 2016 - 08:30
Hi Sara,

I can confirm the bug. The cursor will not go beyond the invisible column in the pecific mode you have (only cell selection and table in non-edit/selection-only mode).
I also tried setting the columnwidht to 0 or even 1. Does not help.

But I this workaround.will do :rp:
Use ControlDelete on the column instead of making it invisible. Then the navigation keeps working.
I don't know your situation but maybe you will need the column back again, based on user choices?
You can do that with ControlClone and add a column and sort of getting it back, i.e. by cloning an existing column which has the same prroperties. Otherwise you have to set some properties on the column as well.
Posté le 04 mai 2016 - 09:12
Hi Arie,,

Thank you for your kindness to share the tip..But unfortunately it doesn't work in my case..
When deleting a column from a Table control using ControlDelete, the content of the Table control associated with this column is deleted. And after deletion even navigation on the entire table stops working..I actually want to retain the column as such but invisible only..
If i clone the column again..the same situation of navigation failure arises..


Can any one rectify the problem??? Seems simple but no solution yet..

I just want the navigation to be moved across visible columns only..No complex code or anything in the table code or column code..

Help plzzzz

Regards,
Sara
Posté le 04 mai 2016 - 09:22
Sara,

cann you tell us why do you need the navigation in the first place, since you say that you use the control in read-only mode.
The user can navigate to cells and then do what? Or is it used to scroll towards cells outside the visible range, like using the scrollbars.

Just an idea: maybe the spreadsheet control will work in this case?
Posté le 04 mai 2016 - 09:48
Hi Sara,

Since it seems to be a confirmed bug, I suggest you raise a ticket with tech support so it can get fixed in a future update.
Next as a solution, I'm just thinking outside of the box for a workaround:

I haven't tested it, but it should do the job as it will make the cursor jump from the invisible cell to the next cell upon entry.
In the table column add the following code upon the 'Entry event' of the row column:
IF NOT myself..visible THEN ReturnToCapture(tablename[TableSelect(tablename),TableColumnSubscript(tablename,myself..name)+1]) END
Something like this should provide you a workaround although not ideal I have to admit.

Best regards,

Peter Holemans
Posté le 04 mai 2016 - 11:07
Peter,

I don't think the on-entry event will fire while Sara uses the tabecontrol in readonly mode.
Maybe Sara will tell us after testing ;)

@Sara: bug confirmed in WD20 so you can send a tech-ticket to pcsoft. And if you are lucky you get a patch.
Maybe it is solved in WD21? I don't have that installed yet, maybe someone else can do a quick test.
Posté le 04 mai 2016 - 11:43
Hi Arie,

I didn't read the initial request good enough it seems...
Here's another try out of my head that may do the same thing and would allow you to also process arrow keys together with SHFT pressed to do continous selection. I've written it out of my head so you may have to tweak it a bit to your needs and to get it compiled.
// -- Initialization code of project // -- Include the "KeyConst.WL" and "WinConst.WL" files EXTERN "KeyConst.WL" EXTERN "WinConst.WL" // -- Initialization code of the window TableToCatchArrowKeys is string = TableName..Name Event(LP_CatchArrowKeys, TableToCatchArrowKeys, WM_KEYDOWN) // -- Local procedure to the window LP_CatchArrowKeys() IF ControlCurrent ~= TableToCatchArrowKeys THEN //Local variables CurrentRow is int = TableSelect(TableToCatchArrowKeys , tsCellLine) CurrentCol is int = TableSelect(TableToCatchArrowKeys , tcCellColumn) //Make sure a cell is currently selected IF CurrentRow > 0 AND CurrentCol > 0 THEN //Right Arrow IF KeyPressed(VK_RIGHT) THEN TableToCatchArrowKeys[CurrentRow,CurrentCol]..Selected = False TableToCatchArrowKeys[CurrentRow,CurrentCol+1]..Selected = True END // Left arrow: move to the left IF KeyPressed(VK_LEFT) THEN TableToCatchArrowKeys[CurrentRow,CurrentCol]..Selected = False TableToCatchArrowKeys[CurrentRow,CurrentCol-1]..Selected = True END // Up arrow: move to the top IF KeyPressed(VK_UP) THEN TableToCatchArrowKeys[CurrentRow,CurrentCol]..Selected = False TableToCatchArrowKeys[CurrentRow-1,CurrentCol]..Selected = True END // Down arrow: move to the bottom IF KeyPressed(VK_DOWN) THEN TableToCatchArrowKeys[CurrentRow,CurrentCol]..Selected = False TableToCatchArrowKeys[CurrentRow+1,CurrentCol]..Selected = True END END END
I hope this helps...

Cheers,

Peter Holemans
Posté le 07 mai 2016 - 11:08
Hi Peter ,

Thank u soo much for ur effort..I tried out your code..but something is missing..

Initialization code of the project and window done as per your instruction..

In the local procedure,Tablerow and Tablecolumn obtained by using following lines, as the supplied code makes errors in my project
CurrentRow is int =CurrentSubscript()
CurrentCol is int = TableSelect(TableToCatchArrowKeys,1,tsCellColumn)

Unfortunately i didnt get the logic of the codelines afterthat..
Actually we need to navigate, if the selction holds on the invisible column only..but your codeline seems like if current row and currentcolumn are nonzero,it triggers to navigate to next coulumn left ,right,up or down as per the keystroke by the user..

And also the following lines makes syntax error

TableToCatchArrowKeys[CurrentRow,CurrentCol]..Selected = False
TableToCatchArrowKeys[CurrentRow,CurrentCol+1]..Selected = True


Mr Peter, Can you spend liitle more time on this to figure out the problem ??
Others also welcome to contribute suggestions..
Posté le 09 mai 2016 - 11:59
Hi Sara,

You need to use indirection.
Here's the adapted code for the procedure:
PROCEDURE LP_CatchArrowKeys() IF ControlCurrent() ~= TableToCatchArrowKeys THEN //Local variables CurrentRow is int = TableSelect(TableToCatchArrowKeys, tsCellLine) CurrentCol is int = TableSelect(TableToCatchArrowKeys, tsColumn) //Make sure a cell is currently selected IF CurrentRow > 0 AND CurrentCol > 0 THEN //Right Arrow IF KeyPressed(VK_RIGHT) THEN {TableToCatchArrowKeys,indControl}[CurrentRow,CurrentCol]..Selected = False {TableToCatchArrowKeys,indControl}[CurrentRow,CurrentCol+1]..Selected = True END // Left arrow: move to the left IF KeyPressed(VK_LEFT) THEN {TableToCatchArrowKeys,indControl}[CurrentRow,CurrentCol]..Selected = False {TableToCatchArrowKeys,indControl}[CurrentRow,CurrentCol-1]..Selected = True END // Up arrow: move to the top IF KeyPressed(VK_UP) THEN {TableToCatchArrowKeys,indControl}[CurrentRow,CurrentCol]..Selected = False {TableToCatchArrowKeys,indControl}[CurrentRow-1,CurrentCol]..Selected = True END // Down arrow: move to the bottom IF KeyPressed(VK_DOWN) THEN {TableToCatchArrowKeys,indControl}[CurrentRow,CurrentCol]..Selected = False {TableToCatchArrowKeys,indControl}[CurrentRow+1,CurrentCol]..Selected = True END END END
It compiles and works here in WD20...

Cheers,

Peter Holemans