Highlighting / Red color of Selected Objects #Bug #New #v5dot2 #V5dot2dot1

Verald Stevens

This question is regarding selected objects not remaining red

Hello, I just updated to XTrackCAD 5.2 from 5.1 as I wanted to use the Layer Module functionality.  I found an odd behavior regarding selecting track/objects.  In previous versions selected track sections always showed as red in color, making it obvious they were selected.  In 5.2 I can select multiple sections of track as before, the selected tracks turn to a red color with a blue surround box.  However, as soon as I choose a tool from the toolbar (Move, Rotate, Mirror, etc) the selected tracks revert to their normal color and there is no indication that any tracks are "selected", even though the tracks are still "selected".  I then have to choose the "Select Objects" tool and then the selected items will again be highlighted.  This is extremely annoying behavior, and I accidentally moved half of my yard as I didn't realize it was still "selected". 

Corollary:  If I select two items (track pieces turn red).  Then place another piece of track - turnout ( The Original track pieces and newly placed turnout turn the normal color - indicating that no items are selected).  Then select the "Move selected objects" tool (still all track pieces are normal color) The originally placed track pieces are moved, but not the turnout. 

Corollary 2:  If I select two items (track pieces turn red).  Then choose a tool (ie Move) (track pieces turn the normal color) - I can move the items.  But if I try to delete by pressing "Delete" on my keyboard the items are not deleted.  I then press the "Select Objects" tool (track pieces turn red again), but I can still not delete them. 

Can anyone explain this behavior or tell me the options to revert to the selected track to remain red color. 


Adam Richards

Two points -

  1. There are two selection modes in V5.2 controlled by options in the Options->Command window. 

  • The old-style "select to add" mode where you keep on clicking/rubberbanding to add and you indicate with +ctrl that you only want this item
  • The new "single item" mode where (as with many programs) you have to indicate with +ctrl that you want to add. The recently placed turnout means the rest of the track 
  • There is also the option to make select on nothing mean de-select (all) or to leave it as in V5.1 where it means "do nothing".

2. There appears to be a bug about the highlighting selected track once out of the select command as you point out. When you go back and forth to Select, the highlighting will re-appear/disappear.  This is likely because the new highlighting is drawn in a different way (in a temp space) and the redraw logic to remember to highlight did not get done.  And it seems that placing the Turnout did not decide if it should (a) deselect or (b) change selection to that turnout alone. So the selection remains unchnaged, but the turnout code also does not show it (as above). 

Now as to delete, it works for me in Select - but on a Mac, at least, I always have had to remember to use real delete (Fn+Delete) because the delete key alone is "backspace". 

Let me look into the bug and see what fix should be done. 


Dave Bullis

Something happened between Beta2.1 and Beta3
Time to triage


Adam Richards

OK - some more is clear. 

Move, Rotate and Flip were not highlighting selected tracks. Fix is ready to push.

Delete only works in Select Cmd/Mode. It was failing silently, but after a fix will tell the user what is wrong.  But Delete works ok apart from that. 

On to -> Add Turnout which doesn't change the select - but it should really Deselect All before it begins. 


Dave Bullis

Seems to be 
Changeset:3209 (56c9c62b6f7f) Merge with V5.2
Previous version (3208) was ok.

Why should adding a turnout deselect all?  Adding other things don't deselect.

Adam Richards

This was a good bug to find!! 

There was a general failure to handle Select appropriately when selecting other commands - this has probably been a problem we all overlooked until it was made obvious by the lack of highlighting.

All Add commands have all been changed to drop the selected tracks when entered as the select is not relevant to Add. Commands - Straight, Curves, Circles, Turntables, Cornu, Turnouts, Structures, Draw Objects, Control, Signal, Sensor, SwitchMotor.

For Modify, Join Line, Split Track, Split Line, Move Description, Elevations all Deselect at the start

Join Track and Connect Track use the selection in Move to Join and to optionally Mass Connect, so they draw the selected correctly now and deselect on exit.

The Move/Rotate/Flip work properly using, showing and preserving selected. 

All changes pushed


Adam Richards

Why should adding a turnout deselect all?  Adding other things don't deselect.

But they (Adds) should Deselect. There is no logic in adding a new item and that item both not being selected but the formerly selected things still being in selected upon return. The user is clearly focused on that (new) item. As the report notes, it is very annoying to have things not expected actually selected and so moving - and the danger (especially in click-to-add mode but not exclusively) is that things are indeed selected but off-screen (which means highlighting or no highlighting, you can't see them). Many experienced 5.2.1 users hit Esc a lot....

For Add another confusion is between the item as it is being added and the formerly selected set - resetting cures that issue.

Much more explainable behavior is that all Adds first reset the selected status to focus on the action. One can argue, I suppose, that after adding the added item should be the returned as the only thing selected, but then we have to ask what happens if someone adds several things in a row via sticky...  So it is cleaner to just have nothing selected after all types of Add. 

The Move/Rotate/Flip commands (and Tunnel and Bridge) operate on a set that is invariant as to membership. So in those cases showing selected tracks and leaving it alone when they complete the command looks good. Note this mirrors behaviour using the mouse equivalents.

Delete removes the selected set, of course.

There are a few other commands that can use select as input of some kind (e.g., Join Track, Connect Track). Those commands will produce a different set of tracks after they execute so showing selected at the start and Deselecting at the end seems sensible.

Otherwise, most commands do not want/need select, and make additions or replacements to the object set and so they should Deselect up front also. 


Dave Bullis

And the selected tracks are not drawn in Red when Move command is selected.
There also appears to be an expectation that the added turnout would be selected as well.  Not sure about that.
I don't see an expectation that the selected track would be deselected when the Turnout was placed.

My concern is that creating a select set can take effort, and the set should not be unselected unless I ask for it (Esc or 'Click on nothing')
This is why I pushed for the 'Deselect all on select nothing' and 'Add to selection...' options


Dave Bullis

I built with your changes and have a suggestion that would help with the 'selected or not?' issue
Currently, in the Select command, a blue highlight box is drawn around the selected tracks.
Other commands that operate on selected track (move/rotate/flip/...) do not.
It would help if all commands that operate on selected tracks drew the highlight box.
This would address problems with not knowing what was selected off-screen.


Adam Richards

OK, good point - I added the Highlighted boxes for those other commands that persist Selected - change pushed..