| Home Page | Recent Changes | Preferences

# Useful UWindow Extensions/Combobox And Editbox

## 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.

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Image Uploads

Random Page

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

Mapping Topics

Mapping Lessons

UnrealEd Interface

Questions&Answers

Scripting Topics

Scripting Lessons

Making Mods

Class Tree

Questions&Answers

Modeling Topics

Questions&Answers

Log In