Recent

Author Topic: Mods please delete -... mouse rolls over the edge (Graph unit)  (Read 461 times)

Weiss

  • New Member
  • *
  • Posts: 46
Mods please delete -... mouse rolls over the edge (Graph unit)
« on: November 06, 2022, 10:57:17 pm »
I did not encounter this problem until I implemented scanning for mouse position and converting mPosX to the index of an array, which has been plotted. When I roll mouse to the edge, program crashes with "out of range" error. It happens with GetMouseState(), before I even implement the conversions.

I thought I would ask for an existing solution before inventing another square wheel.
« Last Edit: November 08, 2022, 02:16:50 am by Weiss »

jamie

  • Hero Member
  • *****
  • Posts: 5069
Re: How to prevent 217 error when mouse rolls over the edge (Graph unit)
« Reply #1 on: November 07, 2022, 02:57:57 am »
Like a lot of short cut programming that has no way to report Un useful information.

  Wrap the call with a TRY ... Call your Code, process it here if Ok, Finally End.

 and run that outside the debugger.

 basically, it generates a fault if no useful information, you need to trap the fault and abort using bad info and try again later.

The only true wisdom is knowing you know nothing

Weiss

  • New Member
  • *
  • Posts: 46
Re: How to prevent 217 error when mouse rolls over the edge (Graph unit)
« Reply #2 on: November 07, 2022, 03:43:39 am »
So far I have been able to handle all possible out of range errors. I am trying not to wrap it in try-finally, I have heard this will slow down my code, and this is right in the middle of interactive graphs being plotted. I wonder if SetViewPort can prevent this from happening.

PascalDragon

  • Hero Member
  • *****
  • Posts: 4880
  • Compiler Developer
Re: How to prevent 217 error when mouse rolls over the edge (Graph unit)
« Reply #3 on: November 07, 2022, 07:18:26 am »
I did not encounter this problem until I implemented scanning for mouse position and converting mPosX to the index of an array, which has been plotted. When I roll mouse to the edge, program crashes with "out of range" error. It happens with GetMouseState(), before I even implement the conversions.

What platform and what Graph unit (e.g. Graph vs. PtcGraph)? Can you provide a simple example that shows this problem?

Weiss

  • New Member
  • *
  • Posts: 46
Re: How to prevent 217 error when mouse rolls over the edge (Graph unit)
« Reply #4 on: November 08, 2022, 02:16:06 am »
sorry fellas, the error was in my code, happened a while earlier just haven't been caught during testing.

case closed, mods please delete all evidence, I never asked this question, it was like this when I came here

 

TinyPortal © 2005-2018