It is currently Fri May 24, 2013 4:58 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: How to select many radio buttons ?
PostPosted: Fri Apr 13, 2012 11:53 pm 
Offline
User
User

Joined: Thu Sep 09, 2010 8:47 am
Posts: 16
Result = OptionGadget(#Gadget, x, y, Width, Height, Text$)

The first time this function is called, a group is created and all following calls of OptionGadget() will add a gadget to this group. To finish the group, just create a gadget of another type. These kind of gadgets are very useful as only one gadget from the group can be selected at any time.

It work difference in Windows and Linux. In Windows I can select more radio buttons in a group. In linux not. How can I select more radio buttons in Linux. I don't no how to start a new group ? Just create a gardget of another type. Have you a example, I don't understand this !

Thanks,

Stephan


Top
 Profile  
 
 Post subject: Re: How to select many radio buttons ?
PostPosted: Sat Apr 14, 2012 12:48 am 
Offline
Addict
Addict

Joined: Fri Oct 23, 2009 2:33 am
Posts: 2863
Location: Wales, UK
Crude example:

Code:
Enumeration
#WinMain
#OptA1
#OptA2
#OptA3
#OptA4
#HiddenTxt
#OptB1
#OptB2
#OptB3
#OptB4
#BtnOK
EndEnumeration

Procedure OpenWin()
;------------------

  If OpenWindow(#WinMain, 0, 0, 300, 200, "Radio buttons", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar|#PB_Window_MaximizeGadget|#PB_Window_ScreenCentered)

              OptionGadget(#OptA1,      10,  10,  100,  25, "Option A 1")
              OptionGadget(#OptA2,      10,  35,  100,  25, "Option A 2")
              OptionGadget(#OptA3,      10,  60,  100,  25, "Option A 3")
              OptionGadget(#OptA4,      10,  85,  100,  25, "Option A 4")
                                                       
                TextGadget(#HiddenTxt,  10, 150,  10,  10, "")
                                                       
              OptionGadget(#OptB1,     200,  10,  100,  25, "Option B 1")
              OptionGadget(#OptB2,     200,  35,  100,  25, "Option B 2")
              OptionGadget(#OptB3,     200,  60,  100,  25, "Option B 3")
              OptionGadget(#OptB4,     200,  85,  100,  25, "Option B 4")

              ButtonGadget(#BtnOK,     100, 150,  100,  30, "OK")


  EndIf

EndProcedure

Procedure WaitForUser()
;---------------------
   Protected iEvent.i = 0
   Protected iGdgID.i = 0

   Repeat
                iEvent = WaitWindowEvent(1)
         Select iEvent

                Case #PB_Event_Gadget

                            iGdgID = EventGadget()
                     Select iGdgID

                            Case #BtnOK :   iEvent = #PB_Event_CloseWindow
                     EndSelect
         EndSelect

   Until iEvent = #PB_Event_CloseWindow

EndProcedure

OpenWin()
WaitForUser()
CloseWindow(#WinMain)
End

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
 
 Post subject: Re: How to select many radio buttons ?
PostPosted: Sun Apr 15, 2012 3:39 am 
Offline
Addict
Addict
User avatar

Joined: Tue Dec 23, 2003 3:54 am
Posts: 932
Location: New York
Here's another way, basically the same, but using a convenient little Macro.

Code:
; Finishes a sequence of OptionGadgets by creating and immediately deleting a temporary TextGadget
Macro FinishOptionGadgets()
  FreeGadget(TextGadget(#PB_Any, 0, 0, 0, 0, ""))
EndMacro


OpenWindow(0, 0, 0, 320, 240, "Option Gadget Groups", #PB_Window_ScreenCentered|#PB_Window_MinimizeGadget)

; Create group 1
For n = 0 To 2
  OptionGadget(n, 10, 10 + n*20, 200, 20, "Hello " + Str(n+1))
Next n
SetGadgetState(0, #True)

; Finish group 1
FinishOptionGadgets()

; Create group 2
For n = 0 To 2
  OptionGadget(n + 3, 10, 75 + n*20, 200, 20, "World " + Str(n+1))
Next n
SetGadgetState(3, #True)

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye