Am 25.11.2015 18:07, schrieb Benoît Minisini:
> Le 25/11/2015 17:58, Rolf-Werner Eilert a écrit :
>> Am 25.11.2015 13:59, schrieb Benoît Minisini:
>>> Le 25/11/2015 09:07, Rolf-Werner Eilert a écrit :
>>>> In one of my older projects, there was kinda timeout after 2 minutes of
>>>> inactivity. In the TreeView the next parent was jumped at and "clicked"
>>>> to let the data of the child disappear from screen. This is the code,
>>>> "baum" is the TreeView:
>>>>
>>>>              baum.MoveParent
>>>>              baum.Item.Selected = True
>>>>              baum_Click
>>>>
>>>> Now in Gambas3, when the program doesn't have the focus anymore, I get a
>>>> "Null object" error at the baum.Item.Selected line.
>>>>
>>>> I know, Item is for the internal cursor. And I want the real cursor. But
>>>> Current is readonly, right? So how can I set the visible cursor? Or does
>>>> the error come from something quite different?
>>>>
>>>> Regards
>>>> Rolf
>>>>
>>> Provide more code. If baum.Item returns NULL, that should mean that
>>> MoveParent() failed.
>>>
>> Ok, that gives me an idea where to look.
>>
>> There is not much more code:
>>
>> Public Sub Timer2_Timer()
>>
>>      If PrivacyPause Then
>>        Timer2EventZlr = 1
>>        Return
>>      End If
>>
>>      If Timer2EventZlr > 0 Then
>>        Timer2EventZlr = 0
>>
>>      Else
>>        If tab.Index = 0 Then
>>          If Left$(baum.Current.Key, 1) = "#" Then
>>            baum.MoveParent
>>            baum.Item.Selected = True
>>            baum_Click
>>          End If
>>        Else
>>          tab.Index = 0
>>        End If
>>
>>      End If
>>
>> End
>>
>> Every 60 seconds the Timer looks if there is another Tab than 0 open. If
>> yes, the first action is to set it back to the first Tab. The next time,
>> it should set the cursor from the personal entry (child) back to its
>> parent, so the personal data aren't shown anymore and you cannot see who
>> was clicked.
>>
>> Of course, there is a check for activity at some places in the program,
>> but this still seems to run as expected. The problem appears only when
>> the program window is hidden and has no focus or when it's on another
>> screen. Maybe the TreeView "forgets" about its position then?
>>
>> Regards
>> Rolf
>>
> No. I guess that accessing baum.Current does not move the Item cursor
> anymore. Just try to add baum.MoveCurrent before baum.MoveParent, it
> should fix your problem.
>
> Regards,
>

Ah sure, I had this at other parts of code too. Ok, I tested it, and it 
really seems to work now. Tomorrow I will run a longer test.

Thanks for the hint!

Regards
Rolf


------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741551&iu=/4140
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to