You are not logged in.

Perry

Beginner

  • "Perry" is male
  • "Perry" started this thread

Posts: 40

Date of registration: Jan 15th 2011

Location: Sarasota, FL

Occupation: Cabinet Design

Hobbies: Programming

  • Send private message

1

Wednesday, July 31st 2013, 1:28pm

Radio Button Menu

I noticed that you have the option of setting up a Radio Button menu.

Dim mnuEdit As VB#VBRadioButtonMenuItem

Also

MenuBar.createRadioButtonMenu

Can anyone give any examples of how to implement these.
I can get the radio button items to show up on the menubar, and I can select them as well .. but radio buttons as opposed to check boxes usually turn off other buttons that are in the same group. The Ideah is that only one in the group can be selected. However if you use my implementation, if you select one of the radio buttons from the menu, the other buttons in the group stay selected and don't turn off. Thinking perhaps I must implement a deselection of the other buttons in code, I looked for a way to reference these menu Items to deselect them. So far I have not been successful.

Can someone help with this? I need an example.

This post has been edited 1 times, last edit by "Perry" (Jul 31st 2013, 1:34pm)


Dani

Intermediate

Posts: 325

Date of registration: Nov 19th 2009

Location: GERMANY

  • Send private message

2

Wednesday, July 31st 2013, 9:56pm

Hey there,

here you go...

Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Option Explicit

Dim tmpGroupFile As VB#VBMenuGroup = Me.MenuBar.createMenuGroup(Nothing, "File", "File", True)
Dim rbtn1Group As VB#VBMenuGroup = Me.MenuBar.createMenuGroup(tmpGroupFile, "RadioButton", "RadioButton",True)
Dim rbtn1 As ButtonGroup = Me.MenuBar.createRadioButtonMenu(rbtn1Group, "rbtn1","Yes", True, True)
Dim rbtn2 As ButtonGroup = Me.MenuBar.createRadioButtonMenu(rbtn1Group, "rbtn2","No", False)

Public Sub Form_MenuClick(MenuItem As VB#IMenuItem)
   Select Case MenuItem.ControlID
      Case "rbtn1"
         rbtn2.clearSelection
      Case "rbtn2"
         rbtn1.clearSelection
   End Select
   MsgBox "Caption: " & MenuItem.Caption & " - ControlID: " & MenuItem.ControlID
End Sub


The implementation in the framework creates an empty icon when no icon is specified. This prevents showing the default Java radiobutton from showing!
Maybe we should change that!?


Dani

Perry

Beginner

  • "Perry" is male
  • "Perry" started this thread

Posts: 40

Date of registration: Jan 15th 2011

Location: Sarasota, FL

Occupation: Cabinet Design

Hobbies: Programming

  • Send private message

3

Thursday, August 1st 2013, 1:06pm

Radio Button Menu

Dani
I made a new project and copied your code into it.
It's thowing an error when it hits line 5
It says Class 'ButtonGroup' Not Found
Am I missing something here? Is there a class that has to be defined?


Later .......................

OK .. Got it to work . Thanks
Had to change it as below.
-------------------------------------------------------

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Option Explicit

Dim tmpGroupFile As VB#VBMenuGroup = Me.MenuBar.createMenuGroup(Nothing, "File", "File", True)
Dim rbtn1Group As VB#VBMenuGroup = Me.MenuBar.createMenuGroup(tmpGroupFile, "RadioButton", "RadioButton",True)
Dim rbtn1 As Javax#swing#ButtonGroup  = Me.MenuBar.createRadioButtonMenu(rbtn1Group, "rbtn1","Yes", True, True)
Dim rbtn2 As Javax#swing#ButtonGroup = Me.MenuBar.createRadioButtonMenu(rbtn1Group, "rbtn2","No", False)

Public Sub Form_MenuClick(MenuItem As VB#IMenuItem)
   Select Case MenuItem.ControlID
      Case "rbtn1"
         rbtn2.clearSelection
      Case "rbtn2"
         rbtn1.clearSelection
   End Select
   MsgBox "Caption: " & MenuItem.Caption & " - ControlID: " & MenuItem.ControlID
End Sub

-------------------------------------

This works great ... Thanks Again

This post has been edited 2 times, last edit by "Perry" (Aug 1st 2013, 2:06pm)


Dani

Intermediate

Posts: 325

Date of registration: Nov 19th 2009

Location: GERMANY

  • Send private message

4

Thursday, August 1st 2013, 8:25pm

Yeah it works, but be aware that this is a detour!
Since

Jabaco Source

1
Me.MenuBar.createRadioButtonMenu


within the framework already creates a ButtonGroup! I am just not sure how to get a handle on it.

https://code.google.com/p/jabacoframewor…enuItem.jsrc#41

Perry

Beginner

  • "Perry" is male
  • "Perry" started this thread

Posts: 40

Date of registration: Jan 15th 2011

Location: Sarasota, FL

Occupation: Cabinet Design

Hobbies: Programming

  • Send private message

5

Friday, August 2nd 2013, 1:34pm

Yes I'm aware it is a detour.
But I find that in many languages, either some item doesn't work as advertised ( even VB built by Microsoft ) or there is something you want to do that has no implementation.
I find the best way to learn a language is to jump in head first, and make an application.
The problem with VB is that the runtime is not distributed adequately, and it will only run on a Microsoft OS, and they are threatning to drop support for it.... ( That all stinks! )
I Hope the Framework gets adjusted to implement this a bit better. No rush as long as I have a work-around.
Java isn't one of my favored Languages, & I'm not as familiar with it, so I don't feel comfortable messing with the framework myself.
Jabaco is still a decent implementation in spite of some of these failings. You can most times find a way through, even if you must lean on Java sometimes. And I'm picking up some Java familiarity just by the necessity of using it sometimes.
I'm making a Library Application for the church I attend which has the option of using a bar code scanner and can print out barcode labels. Almost finished. When I'm done I'll post it. It has many work-arounds ... some of them I'm sure others could do better ... but still it's an education ... It was an education for me.

Just never give up! Keep walking!

Dani

Intermediate

Posts: 325

Date of registration: Nov 19th 2009

Location: GERMANY

  • Send private message

6

Friday, August 2nd 2013, 1:48pm

Hey there Perry,

Quoted

The problem with VB is that the runtime is not distributed adequately, and it will only run on a Microsoft OS, and they are threatning to drop support for it....


well I think VB is so wide spread and discussed that one can pretty much spare MS support. The VB runtime is only around 1MB so it is eaysily distributed nowadays.
To me it is the OS independence and the close resemblance to VB that makes Jabaco so attractive.

Quoted

I Hope the Framework gets adjusted to implement this a bit better


You do know that you can compile your own versions of the framework!?
There are many posts in this forum that describe how it is done...


Dani

Dani

Intermediate

Posts: 325

Date of registration: Nov 19th 2009

Location: GERMANY

  • Send private message

7

Friday, August 2nd 2013, 1:52pm

Quoted

I'm making a Library Application for the church I attend which has the option of using a bar code scanner and can print out barcode labels. Almost finished. When I'm done I'll post it. It has many work-arounds ...


Please do, I'd be interested to take a look at it. Especially the Barcode stuff!


Dani

Rate this thread
WoltLab Burning Board