Re: Centring hyphertextctrl widgets

Dietmar Schwertberger <[email protected]> Mon, 23 Sep 2019 17:46:24 +0200
Newsgroups gmane.comp.python.wxglade
Message-ID <[email protected]>
On 22.09.2019 14:30, Brendan Simon (eTRIX) wrote:
> On Windows, none of the groups render the same. I believe the last 
> group workaround is the same or very close to that of Mac.  I had to 
> use sizers within sizers to get the same effect.  The outer sizer does 
> the main column spacing, and the inner sizers used for the 
> spacer-hypherlink-spacer widgets to get the hypherlink to centre.

It's difficult to assess if you don't post a real-life example, but I 
would guess that one of the variants in the attached file will solve the 
problem.

> It seems a lot of work for a simple centring of a widget.
>
It's perfectly fine to use sizers and spacers for layout. They're made 
for this. They are less platform dependent than the widgets, as they are 
part of wx, not of the OS.
>
> As you know, the wxSHAPED option worked for me (if the proportion is 
> forced to 1 in the generated code).
>
I don't see the point in using some side-effect of some feature which 
will probably behave differently on each platform.

Regards,

Dietmar

_______________________________________________
wxGlade-general mailing list
wxGlade-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/wxglade-general
wxglade_hyperlink_issue_DS.wxg (text/xml, 4.5 KB)
<?xml version="1.0"?>
<!-- generated by wxGlade 0.9.9pre on Mon Sep 23 12:43:25 2019 -->

<application class="MyApp" encoding="UTF-8" for_version="3.0" header_extension=".h" indent_amount="4" indent_symbol="space" is_template="0" language="python" mark_blocks="1" name="app" option="0" overwrite="1" path="./wxglade_out.py" source_extension=".cpp" top_window="frame" use_gettext="0" use_new_namespace="1">
    <object class="MyFrame" name="frame" base="EditFrame">
        <size>532, 484</size>
        <title>frame</title>
        <style>wxDEFAULT_FRAME_STYLE</style>
        <object class="wxBoxSizer" name="sizer_1" base="EditBoxSizer">
            <orient>wxVERTICAL</orient>
            <object class="sizeritem">
                <option>1</option>
                <border>0</border>
                <flag>wxEXPAND</flag>
                <object class="wxBoxSizer" name="outer_sizer_2" base="EditBoxSizer">
                    <orient>wxHORIZONTAL</orient>
                    <object class="sizeritem">
                        <option>1</option>
                        <border>0</border>
                        <flag>wxEXPAND</flag>
                        <object class="wxBoxSizer" name="inner_sizer_3" base="EditBoxSizer">
                            <orient>wxVERTICAL</orient>
                            <object class="sizeritem">
                                <option>0</option>
                                <border>0</border>
                                <flag>wxALIGN_CENTER_HORIZONTAL</flag>
                                <object class="wxHyperlinkCtrl" name="hyperlink_1" base="EditHyperlinkCtrl">
                                    <style>wxHL_ALIGN_CENTRE</style>
                                    <label>a very long description</label>
                                    <attribute>1</attribute>
                                </object>
                            </object>
                        </object>
                    </object>
                    <object class="sizeritem">
                        <option>1</option>
                        <border>0</border>
                        <flag>wxEXPAND</flag>
                        <object class="wxBoxSizer" name="inner_sizer_4" base="EditBoxSizer">
                            <orient>wxVERTICAL</orient>
                            <object class="sizeritem">
                                <option>0</option>
                                <border>0</border>
                                <flag>wxALIGN_CENTER_HORIZONTAL</flag>
                                <object class="wxHyperlinkCtrl" name="hyperlink_2" base="EditHyperlinkCtrl">
                                    <style>wxHL_ALIGN_CENTRE</style>
                                    <label>short</label>
                                    <attribute>1</attribute>
                                </object>
                            </object>
                        </object>
                    </object>
                </object>
            </object>
            <object class="sizeritem">
                <option>1</option>
                <border>0</border>
                <flag>wxEXPAND</flag>
                <object class="wxFlexGridSizer" name="grid_sizer_1" base="EditFlexGridSizer">
                    <rows>1</rows>
                    <cols>2</cols>
                    <vgap>0</vgap>
                    <hgap>0</hgap>
                    <growable_cols>0,1</growable_cols>
                    <object class="sizeritem">
                        <option>0</option>
                        <border>0</border>
                        <flag>wxALIGN_CENTER_HORIZONTAL</flag>
                        <object class="wxHyperlinkCtrl" name="hyperlink_3" base="EditHyperlinkCtrl">
                            <style>wxHL_ALIGN_CENTRE</style>
                            <label>a very long description</label>
                            <attribute>1</attribute>
                        </object>
                    </object>
                    <object class="sizeritem">
                        <option>0</option>
                        <border>0</border>
                        <flag>wxALIGN_CENTER_HORIZONTAL</flag>
                        <object class="wxHyperlinkCtrl" name="hyperlink_4" base="EditHyperlinkCtrl">
                            <style>wxHL_ALIGN_CENTRE</style>
                            <label>short</label>
                            <attribute>1</attribute>
                        </object>
                    </object>
                </object>
            </object>
        </object>
    </object>
</application>