Page 1 of 1

Mouse hover, peeking at variable value

Posted: Sun Jun 02, 2024 3:13 pm
by sc4pb
Hello all, I searched variously and did not see this reported, but not sure how to describe it properly. Often when at a break point in IDE I hover the mouse over a variable name to see its value in the tool tip. I had a half hour of confusion one day when a variable value was coming up incorrectly due to a scope issue (structure member vs. global variable.) Here is a very bad example that illustrates it. (Unfortunately I cannot get screenshot of tool tip)

Code: Select all

Global sName.s

Structure tRecord
  sName.s
  iAge.i
EndStructure

Procedure CursorTipExample()
  
  Define xLocal.tRecord
  
  xLocal\sName="Smith"
  xLocal\iAge=30
  
  Select xLocal\sName     ; Place break point here and run
    Case "Jones"
    Default
      Debug "Local = "+xLocal\sName
  EndSelect
  
EndProcedure

sName="oops, global variable with same name"
Debug "Global = "+sName

CursorTipExample()
I was debugging with a breakpoint on select statement to peek at the value of xLocal\sName ...however when I had cursor over sName portion, I realized (eventually) that it was showing me a completely different variable, a global sName. Ooops, obviously I went and changed the name of my global variable later to avoid confusion.

There was nothing wrong with the running code and actual variable contents, only what was popping up in IDE. Maybe if the mouse hovers over a member of a structure, show the entire structure instead?

Yes this is super minor. And thanks so much for PB.