Skip to content

Add pushbutton appearance for radio buttons #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 4, 2023

Conversation

alankilborn
Copy link
Contributor

Add pushbutton appearance for radio buttons

@Ekopalypse Ekopalypse merged commit 6859c4a into Ekopalypse:master Nov 4, 2023
@alankilborn
Copy link
Contributor Author

Just recording a nice reference I found on BS_PUSHLIKE: https://devblogs.microsoft.com/oldnewthing/20070921-00/?p=25023

@Ekopalypse
Copy link
Owner

Just recording a nice reference ...

Isn't this already possible?

from WinDialog import Dialog, create_dialog_from_rc

rc3 = '''
1 DIALOGEX 0, 0, 374, 289
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP
CAPTION "Test Results"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
FONT 9, "Segoe UI"
{
   CONTROL "", 1, COMBOBOX, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 2, 2, 224, 30
   CONTROL "Peek Information", -1, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 2, 16, 369, 272
   CONTROL "", 2, EDIT, ES_LEFT | ES_MULTILINE | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 6, 26, 362, 259
   CONTROL "P 1.0", 0, BUTTON, BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_CHILD | WS_VISIBLE, 229, 2, 34, 13
   CONTROL "P 2.0", 1, BUTTON, BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_CHILD | WS_VISIBLE, 265, 2, 34, 13
   CONTROL "P 2.2", 2, BUTTON, BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_CHILD | WS_VISIBLE, 301, 2, 34, 13
   CONTROL "P 3.0", 3, BUTTON, BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_CHILD | WS_VISIBLE, 337, 2, 34, 13
}
'''

dlg = create_dialog_from_rc(rc_code=rc3)
dlg.show()

@alankilborn
Copy link
Contributor Author

Isn't this already possible?

Yes, but I don't use the "create from rc" capability of WinDialog.

@Ekopalypse
Copy link
Owner

create_dialog_from_rc and the dialogs created in "class-style" should hopefully behave in the same way.

from WinDialog import Dialog, GroupBox, RadioButton
from WinDialog.controls.button import BS

class ButtonDialog(Dialog):
    def __init__(self, title='Some buttons dialog'):
        super().__init__(title)
        self.size = (250, 200)
        self.center = True
        
        self.btn1 = GroupBox('Group Box 1', (160, 30), (10, 50))
        self.btn2 = RadioButton('Radio button 1', (60,14), (20, 60))
        self.btn2.style += BS.PUSHLIKE
        self.btn3 = RadioButton('Radio button 2', (60,14), (90, 60))
        self.btn3.style += BS.PUSHLIKE

        self.show()

ButtonDialog()

@alankilborn
Copy link
Contributor Author

Ah, I didn't consider that.
Perhaps you should unmerge this PR (as existing capability was sufficient)?

@Ekopalypse
Copy link
Owner

hmm ... I don't know, I'm undecided, but no, let's leave it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants