

LINK: http://cursogambas.blogspot.com.es/2012/08/select-case.html

Ejemplo: Intervalos numericos
Dim opcion As Integer
Print ""
Print "Introduzca un numero entre el 1 al 10:"
Input opcion
Select opcion
Case 1 To 5
Print "Esta entre el 1 al 5"
Case 6 To 10
Print "Esta entre el 6 al 10"
Case Else
Print "fuera del intervalo..."
End Select


Hi,
has anyone tried this before? switching between tabs without clicking them.
Doing it from code pressing Crtl + Tab or something, like Firefox does.

Thanks,
Marcel

-- 
View this message in context: http://www.nabble.com/Switching-between-forms-in-tabstrip-tp22206694p22206694.html
Sent from the gambas-user mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user
By: M0E Lnx
Rank: Starfleet Ensign
Postings: 0
From: n/a
	
Posted: Wed Feb 25, 2009 - 04:56 PM
Have not tried it but I imagine you can code that in the
windows_Keypress() event.
Should be doable

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user
By: Vackoy
Rank: Starfleet Ensign
Postings: 0
From: n/a
	
Posted: Wed Feb 25, 2009 - 05:05 PM

Yes, but which element/object is the observer for the Keypress?
I tried with Workspace.Keypress but when I open a form, the observer becomes
the form and not the workspace, so no matter what key I press it doesn't
raise the event...


M0E Lnx wrote:
>
> Have not tried it but I imagine you can code that in the
> windows_Keypress() event.
> Should be doable
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco,
> CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the
> Enterprise
> -Strategies to boost innovation and cut costs with open source
> participation
> -Receive a $600 discount off the registration fee with the source code:
> SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>

-- 
View this message in context: http://www.nabble.com/Switching-between-forms-in-tabstrip-tp22206694p22207100.html
Sent from the gambas-user mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user
By: Jack
Rank: Starfleet Ensign
Postings: 0
From: n/a
	
Posted: Wed Feb 25, 2009 - 05:29 PM
Le mercredi 25 février 2009 18:03:29 Vackoy, vous avez écrit :
> Yes, but which element/object is the observer for the Keypress?
> I tried with Workspace.Keypress but when I open a form, the observer
> becomes the form and not the workspace, so no matter what key I press it
> doesn't raise the event...
>
> M0E Lnx wrote:
> > Have not tried it but I imagine you can code that in the
> > windows_Keypress() event.
> > Should be doable

As Moe told to you, you can use windows_Keypress() event

EX. suppose you have two textbox named textbox1 and textbox2 declared in group
tbox with tag 1 & 2.
This procedure below show you how going textbox1 to textbox2 and textbox2 to
textbox1.

PUBLIC SUB Tbox_KeyPress()
IF Key.code = Key.enter OR Key.code = Key.Return OR Key.code = Key.Tab THEN
SELECT CASE LAST.tag

CASE 1
Textbox2.SetFocus
STOP EVENT

CASE 2
Textbox1.SetFocus
STOP EVENT
endif
end

I hope that it is it that you want

Jacky


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user
By: Vackoy
Rank: Starfleet Ensign
Postings: 0
From: n/a
	
Posted: Wed Feb 25, 2009 - 05:36 PM

@jacky-12
I understand that but that is not what I need.
Let me see if I can explain it better.
I have a workspace and add several forms to it. In each for i have different
controls as textboxes, buttons, gridviews, etc.
The thing is that I want to be able to switch between forms with some key
combination (i.e. Ctrl + Tab) but the keypress event depends on the control
that has the focus and not on the tabstrip or the workspace.
So how can I "get" the keypress regardless the control or object that has
the focus.

Is there another way of doing this?

Thanks.

Marcel




jacky-12 wrote:
>
> Le mercredi 25 fÃ©vrier 2009 18:03:29 Vackoy, vous avez Ã©crit :
>> Yes, but which element/object is the observer for the Keypress?
>> I tried with Workspace.Keypress but when I open a form, the observer
>> becomes the form and not the workspace, so no matter what key I press it
>> doesn't raise the event...
>>
>> M0E Lnx wrote:
>> > Have not tried it but I imagine you can code that in the
>> > windows_Keypress() event.
>> > Should be doable
>
> As Moe told to you, you can use windows_Keypress() event
>
> EX. suppose you have two textbox named textbox1 and textbox2 declared in
> group
> tbox with tag 1 & 2.
> This procedure below show you how going textbox1 to textbox2 and textbox2
> to
> textbox1.
>
> PUBLIC SUB Tbox_KeyPress()
> IF Key.code = Key.enter OR Key.code = Key.Return OR Key.code = Key.Tab
> THEN
> SELECT CASE LAST.tag
>
> CASE 1
> Textbox2.SetFocus
> STOP EVENT
>
> CASE 2
> Textbox1.SetFocus
> STOP EVENT
> endif
> end
>
> I hope that it is it that you want
>
> Jacky
>
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco,
> CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the
> Enterprise
> -Strategies to boost innovation and cut costs with open source
> participation
> -Receive a $600 discount off the registration fee with the source code:
> SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>

-- 
View this message in context: http://www.nabble.com/Switching-between-forms-in-tabstrip-tp22206694p22207784.html
Sent from the gambas-user mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user
By: =?iso-8859-1?q?Beno=EEt_Minisini?=
Rank: Starfleet Ensign
Postings: 0
From: n/a
	
Posted: Wed Feb 25, 2009 - 06:03 PM
> @jacky-12
> I understand that but that is not what I need.
> Let me see if I can explain it better.
> I have a workspace and add several forms to it. In each for i have
> different controls as textboxes, buttons, gridviews, etc.
> The thing is that I want to be able to switch between forms with some key
> combination (i.e. Ctrl + Tab) but the keypress event depends on the control
> that has the focus and not on the tabstrip or the workspace.
> So how can I "get" the keypress regardless the control or object that has
> the focus.
>
> Is there another way of doing this?
>
> Thanks.
>
> Marcel
>

You need a support for global shortcuts. On Gambas, the only way to do it is
creating an hidden menu with one menu item for each action, each item having a
shortcut.

Regards,

-- 
Benoît

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user
By: M0E Lnx
Rank: Starfleet Ensign
Postings: 0
From: n/a
	
Posted: Wed Feb 25, 2009 - 06:05 PM
The form does have a keypress() event.
If you are using a workspace to host(embed) other forms into one host
form, you'll have to declare a variable that holds the current object
in the workspace, and address the correct object.
For example.

PUBLIC $CurrentObject as Object

on the guest forms open() event... you set this variable.

PUBLIC SUB Form_Open()
Fmain.$CurrentObject = me ' FMAIN is your host form (name it whatever you want)
END

That will give you a common ground to use the host form's _keypress() event

Of course, there must be better ways to do this, but I have used this
method in the past and it works for me

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user
By: Doriano Blengino
Rank: Starfleet Ensign
Postings: 0
From: n/a
	
Posted: Wed Feb 25, 2009 - 06:36 PM
Vackoy ha scritto:
> @jacky-12
> I understand that but that is not what I need.
> Let me see if I can explain it better.
> I have a workspace and add several forms to it. In each for i have different
> controls as textboxes, buttons, gridviews, etc.
> The thing is that I want to be able to switch between forms with some key
> combination (i.e. Ctrl + Tab) but the keypress event depends on the control
> that has the focus and not on the tabstrip or the workspace.
> So how can I "get" the keypress regardless the control or object that has
> the focus.
>
> Is there another way of doing this?
>
I had the same problem some time ago.
The ultimate response is, you can't. To do that, it would be needed a
"KeyPreview" property of the form, which lets the form intercept all the
keypresses before they arrive to its controls, perhaps even before they
reach the Menu.

I managed this situation by using a Menu item, and setting its shortcut.
In the event handler of that menu, you can do whatever you want. This
menu should be hidden, but it was reported that hidden Menus don't
trigger events... but for me it worked (the shortcut was Enter!) - may
be there are differences from GTK or QT.

Regards,
Doriano


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user
By: Vackoy
Rank: Starfleet Ensign
Postings: 0
From: n/a
	
Posted: Wed Feb 25, 2009 - 06:59 PM

Thanks everyone for your responses.
I think that what Benoit and Doriano suggested are in the way of what I
need.

Doriano, the layout of what I have is the following:
* a main form
* a workspace
* several forms added to the workspace by .add method

Where should I add the menu, in the main form? the workspace? sorry but is
beyond what I have tried before
Thanks.


-- 
View this message in context: http://www.nabble.com/Switching-between-forms-in-tabstrip-tp22206694p22209325.html
Sent from the gambas-user mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user
By: Doriano Blengino
Rank: Starfleet Ensign
Postings: 0
From: n/a
	
Posted: Wed Feb 25, 2009 - 07:17 PM
Vackoy ha scritto:
> Thanks everyone for your responses.
> I think that what Benoit and Doriano suggested are in the way of what I
> need.
>
> Doriano, the layout of what I have is the following:
> * a main form
> * a workspace
> * several forms added to the workspace by .add method
>
> Where should I add the menu, in the main form? the workspace? sorry but is
> beyond what I have tried before
> Thanks.
>
I think you should add the menu to the main form, but I never tried
workspaces; I am happy with plain tabstrips.
So, I really don't know if it works well with workspaces, because inside
them there can be another menu, I suppose (well, this is true for
tabstrips too, they can embed other forms). It is not clear to me the
path events take to go from X11 to widget system to gambas to whatever ;-)

Take a try... it should be quick and easy... good luck!

Regards,
Doriano



------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user
By: Dimitris Anogiatis
Rank: Starfleet Ensign
Postings: 0
From: n/a
	
Posted: Wed Feb 25, 2009 - 07:22 PM
If I may add my 2 cents worth,

if you just use the form_keypress event
you might be able to do what you want.

this is my attempt; tbsettings is my tabstrip control
I have 4 tabs (with index 0 to 3)

add this to the form that you have the tabstrip onto

PUBLIC SUB Form_KeyPress()

IF Key.Control THEN

SELECT CASE tbSettings.Index
CASE 0 TO 2
INC tbSettings.Index
CASE 3
tbSettings.index = 0
CASE ELSE
END SELECT

END IF

END

this would result in moving to the next tab when you just press
the control key

I haven't been able to make it to work with a combination of keys
but in Gambas 2.10 it works no matter what control has the focus

I only have one tabstrip control on my GUI so I am not sure if this
solution would work on multiple tabstrips or other layouts

Hope it helps and it's close to what you wanna do.

Regards,
Dimitrios

On Wed, Feb 25, 2009 at 12:14 PM, Doriano Blengino <
doriano.blengino@fastwebnet.it> wrote:

> Vackoy ha scritto:
> > Thanks everyone for your responses.
> > I think that what Benoit and Doriano suggested are in the way of what I
> > need.
> >
> > Doriano, the layout of what I have is the following:
> > * a main form
> > * a workspace
> > * several forms added to the workspace by .add method
> >
> > Where should I add the menu, in the main form? the workspace? sorry but
> is
> > beyond what I have tried before
> > Thanks.
> >
> I think you should add the menu to the main form, but I never tried
> workspaces; I am happy with plain tabstrips.
> So, I really don't know if it works well with workspaces, because inside
> them there can be another menu, I suppose (well, this is true for
> tabstrips too, they can embed other forms). It is not clear to me the
> path events take to go from X11 to widget system to gambas to whatever ;-)
>
> Take a try... it should be quick and easy... good luck!
>
> Regards,
> Doriano
>
>
>
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco,
> CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the
> Enterprise
> -Strategies to boost innovation and cut costs with open source
> participation
> -Receive a $600 discount off the registration fee with the source code:
> SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user
By: Vackoy
Rank: Starfleet Ensign
Postings: 0
From: n/a
	
Posted: Thu Feb 26, 2009 - 01:11 PM

Dimitris,
thanks for the tip. I can get the Keypress event from the form and get the
combination for Ctrl + Tab.
However, since I have a Workspace, I don't know how to access the Tabstrip
control or how to index the forms in it.
Any thoughts?

Thanks


Dimitris Anogiatis wrote:
>
> If I may add my 2 cents worth,
>

-- 
View this message in context: http://www.nabble.com/Switching-between-forms-in-tabstrip-tp22206694p22223618.html
Sent from the gambas-user mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user
By: =?iso-8859-1?q?Beno=EEt_Minisini?=
Rank: Starfleet Ensign
Postings: 0
From: n/a
	
Posted: Thu Feb 26, 2009 - 01:28 PM
> Dimitris,
> thanks for the tip. I can get the Keypress event from the form and get the
> combination for Ctrl + Tab.
> However, since I have a Workspace, I don't know how to access the Tabstrip
> control or how to index the forms in it.

You don't.

You must use the Workspace.Children property to get an array of all child
windows, choose your window, and then set the Workspace.ActiveWindow property.

Regards,

-- 
Benoît

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user
By: Dimitris Anogiatis
Rank: Starfleet Ensign
Postings: 0
From: n/a
	
Posted: Thu Feb 26, 2009 - 03:44 PM
After reading Benoît 's guidelines and going through my previous example
I came up with this.

PUBLIC SUB Form_KeyPress()
IF Key.Control
SELECT CASE Workspace1.Children.Find(Workspace1.ActiveWindow)
CASE 0 TO Workspace1.Children.Count - 2
Workspace1.ActiveWindow =
Workspace1.Children[Workspace1.Children.Find(Workspace1.ActiveWindow) + 1]
CASE Workspace1.Children.Count - 1
Workspace1.ActiveWindow = Workspace1.Children[0]
CASE ELSE
END SELECT
ENDIF
END

Add this to the code of the form that has the workspace

it should have the desired effect.

Hopefully this will bring you closer to what you want to do.

Regards
Dimitris

On Thu, Feb 26, 2009 at 6:20 AM, Benoît Minisini <
gambas@users.sourceforge.net> wrote:

> > Dimitris,
> > thanks for the tip. I can get the Keypress event from the form and get
> the
> > combination for Ctrl + Tab.
> > However, since I have a Workspace, I don't know how to access the
> Tabstrip
> > control or how to index the forms in it.
>
> You don't.
>
> You must use the Workspace.Children property to get an array of all child
> windows, choose your window, and then set the Workspace.ActiveWindow
> property.
>
> Regards,
>
> --
> Benoît
>
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco,
> CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the
> Enterprise
> -Strategies to boost innovation and cut costs with open source
> participation
> -Receive a $600 discount off the registration fee with the source code:
> SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user
By: Vackoy
Rank: Starfleet Ensign
Postings: 0
From: n/a
	
Posted: Thu Feb 26, 2009 - 08:35 PM

I tried this last example and it worked like a charm. Thanks.

Marcel

-- 
View this message in context: http://www.nabble.com/Switching-between-forms-in-tabstrip-tp22206694p22233025.html
Sent from the gambas-user mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user
