Legacy:Useful UWindow Extensions/Combobox And Editbox - Unreal Wiki

# Legacy:Useful UWindow Extensions/Combobox And Editbox

### From Unreal Wiki, The Unreal Engine Documentation Site

< Legacy:Useful UWindow Extensions

## Auto-Sizing Combo and Edit controls

These controls consist of a caption and an editbox or a drop-down list. This code changes the width of that box to fill the available space behind the caption without resizing the control itself. Since UWindowEditControl and UWindowComboControl use the same names for the corresponding properties both controls can use the following code:

    var bool bAutoSize;

    function BeforePaint(Canvas C, float X, float Y)
    {
        local float TW, TH;

        if ( bAutoSize ) {
            TextSize(C, Text, TW, TH);
            EditBoxWidth = WinWidth - TW;
        }
        Super.BeforePaint(C, X, Y);
    }

This could also be used for the UWindowHSliderControl (you only need to change `EditBoxWidth` to `SliderWidth`), but this only looks good if the slider's text doesn't change when the slider is moved.

##### Views

- Legacy
- Discussion
- Current revision

##### Search