Setfocus issue

View: New views
7 Messages — Rating Filter:   Alert me  

Setfocus issue

by Ron Klinkien :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi,

I have a window with 2 Textboxes I want to give focus to TextBox2 upon
loading of the form, if I open the form as a normal window, it's ok.
Textbox2 gets the focus.
If I load the form on a workspace, TextBox2.SetFocus doesn't work.

See attached example project

Do I have to reread the docs and shame myself, or should it work the
same way with workspace and normal window?

Regards,
Ron the 2nd.


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Gambas-user mailing list
Gambas-user@...
https://lists.sourceforge.net/lists/listinfo/gambas-user

SetFocus-0.0.1.tar.gz (11K) Download Attachment

Re: Setfocus issue

by M0E Lnx :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

what do you mean load it from a "workspace"


On Wed, Jun 25, 2008 at 3:23 PM, Ron <ron@...> wrote:

>
> Hi,
>
> I have a window with 2 Textboxes I want to give focus to TextBox2 upon
> loading of the form, if I open the form as a normal window, it's ok.
> Textbox2 gets the focus.
> If I load the form on a workspace, TextBox2.SetFocus doesn't work.
>
> See attached example project
>
> Do I have to reread the docs and shame myself, or should it work the same
> way with workspace and normal window?
>
> Regards,
> Ron the 2nd.
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> Gambas-user mailing list
> Gambas-user@...
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Gambas-user mailing list
Gambas-user@...
https://lists.sourceforge.net/lists/listinfo/gambas-user

Re: Setfocus issue

by Ron Klinkien :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Like so:
---

PUBLIC SUB Button3_Click()

  OpenPage(FBarcode)

END

' load a page onto the workspace
PUBLIC SUB OpenPage(hForm AS Form)

  Workspace1.Add(hForm)
  Workspace1.ActiveWindow = hForm
  hForm.SetFocus
 
END
---

Instead of:

PUBLIC SUB Button1_Click()

  FBarcode.Show

END

Regards,
Ron.


> what do you mean load it from a "workspace"
>
>
> On Wed, Jun 25, 2008 at 3:23 PM, Ron <ron@...> wrote:
>  
>> Hi,
>>
>> I have a window with 2 Textboxes I want to give focus to TextBox2 upon
>> loading of the form, if I open the form as a normal window, it's ok.
>> Textbox2 gets the focus.
>> If I load the form on a workspace, TextBox2.SetFocus doesn't work.
>>
>> See attached example project
>>
>> Do I have to reread the docs and shame myself, or should it work the same
>> way with workspace and normal window?
>>
>> Regards,
>> Ron the 2nd.
>>
>> -------------------------------------------------------------------------
>> Check out the new SourceForge.net Marketplace.
>> It's the best place to buy or sell services for
>> just about anything Open Source.
>> http://sourceforge.net/services/buy/index.php
>> _______________________________________________
>> Gambas-user mailing list
>> Gambas-user@...
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>
>>
>>    
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> Gambas-user mailing list
> Gambas-user@...
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>  


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Gambas-user mailing list
Gambas-user@...
https://lists.sourceforge.net/lists/listinfo/gambas-user

Re: Setfocus issue

by Benoit Minisini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On mercredi 25 juin 2008, Ron wrote:

> Hi,
>
> I have a window with 2 Textboxes I want to give focus to TextBox2 upon
> loading of the form, if I open the form as a normal window, it's ok.
> Textbox2 gets the focus.
> If I load the form on a workspace, TextBox2.SetFocus doesn't work.
>
> See attached example project
>
> Do I have to reread the docs and shame myself, or should it work the
> same way with workspace and normal window?
>
> Regards,
> Ron the 2nd.

There were some bugs in both gb.qt, gb.gtk and gb.form.mdi. I fixed them in
revision #1433.

Regards,

--
Benoit Minisini

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Gambas-user mailing list
Gambas-user@...
https://lists.sourceforge.net/lists/listinfo/gambas-user

Re: Setfocus issue

by Ron Klinkien :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Benoit Minisini schreef:

> On mercredi 25 juin 2008, Ron wrote:
>  
>> Hi,
>>
>> I have a window with 2 Textboxes I want to give focus to TextBox2 upon
>> loading of the form, if I open the form as a normal window, it's ok.
>> Textbox2 gets the focus.
>> If I load the form on a workspace, TextBox2.SetFocus doesn't work.
>>
>> See attached example project
>>
>> Do I have to reread the docs and shame myself, or should it work the
>> same way with workspace and normal window?
>>
>> Regards,
>> Ron the 2nd.
>>    
>
> There were some bugs in both gb.qt, gb.gtk and gb.form.mdi. I fixed them in
> revision #1433.
>
>
>  
Hi,

I just upgraded to #1433, but it doesn't seem to work (when you click
the "not ok" button) in my example project SetFocus-0.0.1.tar.gz in my
earlier mail.

Regards,
Ron the 2nd.




-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Gambas-user mailing list
Gambas-user@...
https://lists.sourceforge.net/lists/listinfo/gambas-user

Re: Setfocus issue

by Benoit Minisini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On jeudi 26 juin 2008, Ron wrote:

> Benoit Minisini schreef:
> > On mercredi 25 juin 2008, Ron wrote:
> >> Hi,
> >>
> >> I have a window with 2 Textboxes I want to give focus to TextBox2 upon
> >> loading of the form, if I open the form as a normal window, it's ok.
> >> Textbox2 gets the focus.
> >> If I load the form on a workspace, TextBox2.SetFocus doesn't work.
> >>
> >> See attached example project
> >>
> >> Do I have to reread the docs and shame myself, or should it work the
> >> same way with workspace and normal window?
> >>
> >> Regards,
> >> Ron the 2nd.
> >
> > There were some bugs in both gb.qt, gb.gtk and gb.form.mdi. I fixed them
> > in revision #1433.
>
> Hi,
>
> I just upgraded to #1433, but it doesn't seem to work (when you click
> the "not ok" button) in my example project SetFocus-0.0.1.tar.gz in my
> earlier mail.
>
> Regards,
> Ron the 2nd.
>

Yes, because you call hForm.SetFocus() just after adding it to the Workspace,
so the SetFocus inside the Open event handler is lost!

--
Benoit Minisini

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Gambas-user mailing list
Gambas-user@...
https://lists.sourceforge.net/lists/listinfo/gambas-user

Re: Setfocus issue

by Ron Klinkien :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Benoit Minisini schreef:

> On jeudi 26 juin 2008, Ron wrote:
>  
>> Benoit Minisini schreef:
>>    
>>> On mercredi 25 juin 2008, Ron wrote:
>>>      
>>>> Hi,
>>>>
>>>> I have a window with 2 Textboxes I want to give focus to TextBox2 upon
>>>> loading of the form, if I open the form as a normal window, it's ok.
>>>> Textbox2 gets the focus.
>>>> If I load the form on a workspace, TextBox2.SetFocus doesn't work.
>>>>
>>>> See attached example project
>>>>
>>>> Do I have to reread the docs and shame myself, or should it work the
>>>> same way with workspace and normal window?
>>>>
>>>> Regards,
>>>> Ron the 2nd.
>>>>        
>>> There were some bugs in both gb.qt, gb.gtk and gb.form.mdi. I fixed them
>>> in revision #1433.
>>>      
>> Hi,
>>
>> I just upgraded to #1433, but it doesn't seem to work (when you click
>> the "not ok" button) in my example project SetFocus-0.0.1.tar.gz in my
>> earlier mail.
>>
>> Regards,
>> Ron the 2nd.
>>
>>    
>
> Yes, because you call hForm.SetFocus() just after adding it to the Workspace,
> so the SetFocus inside the Open event handler is lost!
>
>  
I had remove hForm.SetFocus() before, because I suspected the same, but
that was yesterday, before your bugfix.

I use the OpenPage() routine, so it opens a form if it isn't on the
workspace yet, or it lets a form gets focus (in front) when it was
already added before.
So I always have 1 form of each name opened ones, and not more than once.

But I needed that hForm.SetFocus() call to let my application work ok,
which I found strange to begin with, the Workspace1.Activewindow = hForm
should be enough, but it seems that one of your bugfixes fixed that too,
so hForm.SetFocus() isn't needed anymore to get a window in front.

Even better! Thanks.

Regard,
Ron the 2nd.


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Gambas-user mailing list
Gambas-user@...
https://lists.sourceforge.net/lists/listinfo/gambas-user
LightInTheBox - Buy quality products at wholesale price