I managed to get the code working again but everytime the scanner is powered off this method fires and crashes with IMA with the error mark on the EndProcedure line. Sometimes I get "Program aborted (by external library)".Shardik wrote:Code: Select all
ProcedureC didRemoveDeviceInBrowser(object.i, selector.i, deviceBrowser.i, removedDevice.i, moreGoing.i) Debug "device removed in browser..." CocoaMessage(0, removedDevice, "requestCloseSession") CocoaMessage(0, removedDevice, "setDelegate:", 0) RemoveGadgetItem(#scannerList, selectedScanner - 1) ReDim scanners(ArraySize(scanners()) - 1) EndProcedure ;IMA!
Maybe the device browser terminates and ends the delegate (PB app) when all scanners are removed so we should make another delegate for it and not use the main PB app. I tried to follow this example but it doesn't work:
From this post: http://www.forums.purebasic.com/english ... a0#p497287
Code: Select all
; ----- Subclass ListIconGadget
SubclassedListIconGadget = objc_allocateClassPair_(CocoaMessage(0,
GadgetID(0), "class"), "SubclassedListIconGadget", 0)
objc_registerClassPair_(SubclassedListIconGadget)
object_setClass_(GadgetID(0), SubclassedListIconGadget)