@@ -284,6 +284,7 @@ def initOverlayClass(self):
284284 def script_changeItem (self ,gesture ):
285285 gesture .send ()
286286 self .ReadGridSelection ()
287+ pass
287288
288289
289290 def event_gainFocus (self ):
@@ -293,20 +294,23 @@ def event_gainFocus(self):
293294 if config .conf ['VismaAdministration' ]['sayNumGridRows' ]:
294295 ui .message ("Rad %d av %d markerad" % (self .GetCurrentRow () + 1 , self ._get_rowCount ()))
295296 self .ReadGridSelection ()
297+ pass
296298 except Exception as e :
297299 log .info ("Fel i VismaSafGrid.gainFocus: %s" % e )
298300 ui .message ("Fel i VismaSafGrid.gainFocus: %s" % e )
299301
300302 def event_UIA_selectionInvalidated (self ):
301303 try :
302304 self .ReadGridSelection ()
305+ pass
303306 except Exception as e :
304307 log .info ("Fel i VismaSafGrid.event_UIA_selectionInvalidated: %s" % e )
305308 ui .message ("Fel i VismaSafGrid.event_UIA_selectionInvalidated: %s" % e )
306309
307310 def event_UIA_AutomationFocusChanged (self , obj , nextHandler ):
308311 try :
309312 self .ReadGridSelection ()
313+ pass
310314 except Exception as e :
311315 log .info ("Fel i VismaSafGrid.event_UIA_AutomationFocusChanged: %s" % e )
312316 ui .message ("Fel i VismaSafGrid.event_UIA_AutomationFocusChanged: %s" % e )
@@ -321,6 +325,7 @@ def event_UIA_AutomationFocusChanged(self, obj, nextHandler):
321325 def script_readNumGridRows (self , gesture ):
322326 ui .message ("Rad %d av %d markerad" % (self .GetCurrentRow () + 1 , self ._get_rowCount ()))
323327 self .ReadGridSelection ()
328+ pass
324329
325330 @script (
326331 # Translators: Gesture description
@@ -332,6 +337,7 @@ def script_readGridSelection(self, gesture):
332337 # Pass the keystroke along
333338 #gesture.send()
334339 self .ReadGridSelection ()
340+ pass
335341
336342
337343 def ReadGridSelection (self ):
@@ -424,7 +430,12 @@ def ReadGridSelection(self):
424430
425431 def GetCurrentRow (self ):
426432 try :
433+ UIAPointer = UIAClient .ElementFromHandleBuildCache (self .windowHandle , UIAHandler .handler .baseCacheRequest )
434+ if UIAPointer == None :
435+ return 0
427436 selpat = self ._getUIAPattern (UIAHandler .UIA_SelectionPatternId ,UIAHandler .IUIAutomationSelectionPattern )
437+ if selpat == None :
438+ return 0
428439 cursel = selpat .GetCurrentSelection ()
429440 selement = cursel .GetElement (0 )
430441 return selement .GetCurrentPropertyValue (UIAHandler .UIA_GridItemRowPropertyId )
@@ -483,6 +494,7 @@ def get_tab_text(self,idx):
483494 if idx == - 1 :
484495 tabidx = watchdog .cancellableSendMessage (self .windowHandle , TCM_GETCURSEL , 0 , 0 )
485496 bufLen = 256
497+ #ui.message("Flik: %d" % tabidx)
486498 info = TCITEMWStruct ()
487499 info .mask = TCIF_TEXT
488500 info .textMax = bufLen - 1
0 commit comments