Page 1 of 1

Compiler syntax check: correct line, wrong marker

Posted: Wed Aug 10, 2016 3:08 pm
by IdeasVacuum
PB5.43LTS x86 Win7

This does not happen often but sometimes the compiler identifies a faulty code line, but displays the marker on a different line.
Image

Re: Compiler syntax check: correct line, wrong marker

Posted: Thu Aug 11, 2016 9:28 am
by Fred
If you can reproduce it we could to take a closer look.

Re: Compiler syntax check: correct line, wrong marker

Posted: Thu Aug 11, 2016 11:06 am
by Dude
IdeasVacuum, are you using line continuation? I think it's related to that.

Re: Compiler syntax check: correct line, wrong marker

Posted: Thu Aug 11, 2016 12:51 pm
by mestnyi
The problem with "SetGadgetText()" now look at an example that demonstrates this.

Code: Select all

OpenWindow(0,0,0,400,400,"")
EditorGadget(1,10,10,50,30)
 
Repeat
  Event = WaitWindowEvent()
  Select Event
    Case #PB_Event_Gadget 
      SetGadgetText(1,"Синий")
      
      Debug "Somehow it includes cycle"
  EndSelect
Until Event = #PB_Event_CloseWindow
End

Re: Compiler syntax check: correct line, wrong marker

Posted: Thu Aug 11, 2016 2:39 pm
by infratec
@mestny
What has your code to do with the problem?

You get a loop because always a #PB_EventType_Change is produced.
Maybe that's not correct, because when I set a text via program, I know that it is changed.
But that's an other thing.

Bernd

Re: Compiler syntax check: correct line, wrong marker

Posted: Thu Aug 11, 2016 3:01 pm
by IdeasVacuum
...not using line continuation (never have).

You have to be several hours in before the error occurs. I'd been working for about 10 hours (with breaks), then the complier marker became out of synch with the erroneous line. I reported it because this is not the first time (I know, hard to believe I get anything wrong eh? :D ), but it is not so important of course.

Re: Compiler syntax check: correct line, wrong marker

Posted: Thu Aug 11, 2016 3:03 pm
by mestnyi
You get a loop because always a #PB_EventType_Change is produced.
It is not true.
I do not know how you check but I believe that this is a bug because of this all Bedi
In "EditorGadget" there is no such event in 1024 and why there?

Code: Select all

OpenWindow(0,0,0,400,400,"")
EditorGadget(1,10,10,50,30)
EditorGadget(2,110,110,50,30)

;  The following events are supported through EventType(): 
;   768 #PB_EventType_Change   : the Text has been modified by the user.
;   14000 #PB_EventType_Focus    : the editor has got the focus.
;   14001 #PB_EventType_LostFocus: the editor has lost the focus.

Debug #PB_EventType_LostFocus
Repeat
  Event = WaitWindowEvent()
  Select Event
    Case #PB_Event_Gadget 
         Debug "Somehow it includes cycle "+EventType() ; 1024 Why?????????????????????
           SetGadgetText(1,"Blue")
              
;       Select EventType()
;         Case #PB_EventType_Change
;           Select EventGadget()
;             Case 1
;               SetGadgetText(1,"Blue")
;             Case 2
;               SetGadgetText(2,"Red")
;           EndSelect
;       EndSelect
  
      Debug "Somehow it includes cycle "+EventGadget()
  EndSelect
Until Event = #PB_Event_CloseWindow
End

Re: Compiler syntax check: correct line, wrong marker

Posted: Thu Aug 11, 2016 3:29 pm
by infratec
@mestnyi

1. But still: What have your code to do with the problem of IdeasVacuum

2. You have always to check the type of an event.
So your code in general is not correct.
If you check for the valid EventTypes you don't run in a loop.

You can not rely on events which are not 'valid' for the gadget.

Code: Select all

OpenWindow(0,0,0,400,400,"")
EditorGadget(1,10,10,50,30)
ButtonGadget(2,110,110,80,30, "SetText")

Repeat
  Event = WaitWindowEvent()
  Select Event
    Case #PB_Event_Gadget
      Select EventGadget()
        Case 1
          Debug "EditorGadget event: " + Str(EventType())
          Select EventType()
            Case #PB_EventType_Change
              Debug "Changed"
            Case #PB_EventType_Focus
              Debug "Focus"
            Case #PB_EventType_LostFocus
              Debug "LostFocus"
          EndSelect
        Case 2
          SetGadgetText(1,"Test")
      EndSelect
  EndSelect
Until Event = #PB_Event_CloseWindow
End
Bernd

Re: Compiler syntax check: correct line, wrong marker

Posted: Thu Aug 11, 2016 4:24 pm
by mestnyi
:) :) :) As if I do not know. :shock:
I just wanted to PB was an ideal rather than an unpredictable. :wink: