Date: prev next · Thread: first prev next last
2015 Archives by date, by thread · List index


Hi Johnny,

thanks for your reply.

Usually my radio buttons are working. Just in this case, they don't. - And all of them had the same listener. But I discovered that I can get them working, when I don't set all of the buttons, labels etc. in one loop. I seperated the radio buttons and set them in an extra loop. Now they are working again.

That doesn't make much sense to me, but at least it works.




2015-05-16 13:08 GMT+02:00 Johnny Rosenberg <gurus.knugum@gmail.com <mailto:gurus.knugum@gmail.com>>:

   2015-05-16 8:59 GMT+02:00 X Roemer <x-roemer@web.de
   <mailto:x-roemer@web.de>>:

       Hi,

       I use always the same mechanism to add radio buttons by code.
       Usually I add one after one, directly after each other, and they
       get grouped automatically. But this time I can choose more than
       one and the others don't get disabled. (See screenshot)

       I know, it's better to show some code, but it would be a bit too
       much, as the creation of widgets is splitted into several steps.

       My questions are:
       - Is there a mechanism to group radio buttons by code instead of
       adding them one directly after the other?


   The first way that comes to my mind is to assign a macro to each one
   of them (the same macro). It's possible for a macro to determine
   which radiobutton the call came from, so what the macro could do is
   just to unselect all the other radio buttons.


Here's an example from my Maxy-Yatzy Game for Calc (OpenOffice, but I think that doesn't matter much in this case):
' Code starts here
Sub NumbersButton(Button As Object)
Dim ButtonName As String, ButtonNumber As Integer, State As Boolean
ButtonName=Button.Source.getModel().Name
ButtonNumber=GetButtonNumber(ButtonName)
ButtonState(ButtonNumber)=Not ButtonState(ButtonNumber)

'If Button state is TRUE, unselect Category.
If ButtonState(ButtonNumber) Then' Save relevant dice.
UnselectCategoryButtonPushed
Button.Source.getModel().setPropertyValue("TextColor",Black)
Else' Re-roll relevant dice.
Button.Source.getModel().setPropertyValue("TextColor",Gray)
EndIf

SetAllDiceState
SetRollButtonState(Auto)
End Sub
' End of code

In this case, Button is the object to use for determining what caused the subroutine to start. I call a couple of functions in this to make things happen to other buttons and things like that. For instance, the name of the button that was pressed is found in Button.Source.getModel().Name.

In this case no radio buttons were involved, but that doesn't matter much. It would be pretty much the same. In this case it's just an ordinary button without a frame and with a unicode character label, for instance ”⚂”, so it looks like I'm clicking a die, but the procedure is the same for check boxes, radio buttons and even images. Everything that's clickable.

(OFF TOPIC: Maxy-Yatzy is a Swedish variant of Yatzee where six dice are used and you can save rolls for later. New categories, due to the six dices, are three pairs – XXYYZZ, five of a kind – XXXXX?, full straight – 123456, tower – XXYYYY and house – XXXYYY. A total of ≥84 p in the upper categories gives a 100 p Bonus, Maxi-Yatzy – XXXXXX, gives 100 p. That's pretty much it… kind of.)

Kind regards

Johnny Rosenberg
ジョニー・ローゼンバーグ



   Maybe there are better ways, I don't know…

       - Can someone guess, what else can go wrong?

       Regards,
       Xaver

-- To unsubscribe e-mail to:
       users+unsubscribe@global.libreoffice.org
       <mailto:users%2Bunsubscribe@global.libreoffice.org>
       Problems?
       http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
       Posting guidelines + more:
       http://wiki.documentfoundation.org/Netiquette
       List archive: http://listarchives.libreoffice.org/global/users/
       All messages sent to this list will be publicly archived and
       cannot be deleted





Am 16.05.2015 um 09:03 schrieb X Roemer:
Screenshot can be found here:

https://github.com/XRoemer/Organon/blob/master/Screenshots/radio%20buttons%20dont%20work.png







Am 16.05.2015 um 08:59 schrieb X Roemer:
Hi,

I use always the same mechanism to add radio buttons by code. Usually I add one after one, directly after each other, and they get grouped automatically. But this time I can choose more than one and the others don't get disabled. (See screenshot)

I know, it's better to show some code, but it would be a bit too much, as the creation of widgets is splitted into several steps.

My questions are:
- Is there a mechanism to group radio buttons by code instead of adding them one directly after the other?
- Can someone guess, what else can go wrong?

Regards,
Xaver





--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.