Runtime ERR on Mac running Yosemite. No error on Windows box
Posted: Wed Jan 14, 2015 11:55 pm
I'm just leaning PB and I wrote a simple factoring program and ran it fine on my windows box. That same code gave me a run time error on my Mac running Yosemite saying I've not initialized the gadget ID when I issued a SetActiveGadget() command. This SAME code works fine on the Windows box. I ran it in debug mode and found that the gadget ID is indeed set prior to the command. Here is the code section.
Can anybody advise? I would appreciate any input you have.
-Many thanks
-Don
----------------------
If OpenWindow(#WINDOW_MAIN, 0, 0, #WindowWidth, #WindowHeight, "Factor Integers", #FLAGS)
If LoadFont(0, "Arial", 12)
SetGadgetFont(#PB_Default, FontID(0)) ; Set the loaded Arial 16 font as new standard
EndIf
lbl1.l = TextGadget(#PB_Any, 20, 40, 200, 40, "Enter Integer Value: ")
txtInput.l = StringGadget(#PB_Any, 170, 35, 200, 24, "")
btnFactor.l = ButtonGadget(#PB_Any, 170, 70, 60, 30, "Factor")
btnQuit.l = ButtonGadget(#PB_Any, 250, 70, 60, 30, "Quit")
ScrollAreaA.l = ScrollAreaGadget(#PB_Any, 20, 120, 400, 250, 500, 1400) ;
txtOutputFactors = TextGadget(#PB_Any, 20, 10, 400, 1400, "")
CloseGadgetList()
SetActiveGadget(txtInput) ;PROBLEM get run time error on this statement says gadget ID not initialized?!
Repeat
Event.l = WaitWindowEvent()
If Event = #PB_Event_Gadget
Select EventGadget()
Case btnFactor
inFactor.q = Val(GetGadgetText(txtinput))
CalcFactors(inFactor)
SetGadgetText(txtOutputFactors, factors)
Case btnQuit
End
EndSelect
EndIf
Until Event = #PB_Event_CloseWindow
EndIf
Can anybody advise? I would appreciate any input you have.
-Many thanks
-Don
----------------------
If OpenWindow(#WINDOW_MAIN, 0, 0, #WindowWidth, #WindowHeight, "Factor Integers", #FLAGS)
If LoadFont(0, "Arial", 12)
SetGadgetFont(#PB_Default, FontID(0)) ; Set the loaded Arial 16 font as new standard
EndIf
lbl1.l = TextGadget(#PB_Any, 20, 40, 200, 40, "Enter Integer Value: ")
txtInput.l = StringGadget(#PB_Any, 170, 35, 200, 24, "")
btnFactor.l = ButtonGadget(#PB_Any, 170, 70, 60, 30, "Factor")
btnQuit.l = ButtonGadget(#PB_Any, 250, 70, 60, 30, "Quit")
ScrollAreaA.l = ScrollAreaGadget(#PB_Any, 20, 120, 400, 250, 500, 1400) ;
txtOutputFactors = TextGadget(#PB_Any, 20, 10, 400, 1400, "")
CloseGadgetList()
SetActiveGadget(txtInput) ;PROBLEM get run time error on this statement says gadget ID not initialized?!
Repeat
Event.l = WaitWindowEvent()
If Event = #PB_Event_Gadget
Select EventGadget()
Case btnFactor
inFactor.q = Val(GetGadgetText(txtinput))
CalcFactors(inFactor)
SetGadgetText(txtOutputFactors, factors)
Case btnQuit
End
EndSelect
EndIf
Until Event = #PB_Event_CloseWindow
EndIf