1. [IUP] IupText minimum size [SOLVED]

I am trying to make the text field auto-expand when the window is resized. If I start with a size of 100x100 then it works pretty much as I want (apart from being the wrong size and place), however if I start with a size of 800x100 then it seems to set a minimum size on the text field that it will not shrink below, so the X is clipped below 800. Any ideas?

(include pGUI.e) 
Ihandle flbl, ftxt, flb2, box, dlg 
 
    IupOpen() 
 
    flbl = IupLabel("Filter") 
    ftxt = IupText("") 
    IupSetAttribute(ftxt, "EXPAND", "HORIZONTAL") 
    flb2 = IupLabel("X") 
     
    box = IupHbox({flbl,ftxt,flb2}) 
    IupSetAttribute(box, "MARGIN", "2x2") 
    IupSetAttribute(box, "GAP", "10") 
 
    dlg = IupDialog(box) 
    IupSetAttribute(dlg, "TITLE", "pdemo") 
    IupSetAttribute(dlg, "SIZE", "100x100") 
--  IupSetAttribute(dlg, "SIZE", "800x100") 
 
    IupShow(dlg) 
    IupMainLoop() 
    IupClose() 

Pete

SOLVED [17 hours later]: use IupSetAttribute(dlg, "SHRINK", "YES"). (The shrink attribute does not work on ftxt, btw, only the containing dialog.)

new topic     » topic index » view message » categorize

2. Re: [IUP] IupText minimum size [SOLVED]

When there is not enough horizontal size for all the elements clipping starts from the right-hand-side; clipping always sacrifices the right most elements and tries to preserve the left most elements. I couldn't find a way to defeat this rule.

You could try MINSIZE as an attribute rather than SIZE. (But RHS clipping still seems to follow the same rules.)

You could create a dynamic layout that reads the size of the dialog and then sets the attributes or the elements.

_tom

new topic     » goto parent     » topic index » view message » categorize

3. Re: [IUP] IupText minimum size [SOLVED]

_tom said...

When there is not enough horizontal size for all the elements clipping starts from the right-hand-side; clipping always sacrifices the right most elements and tries to preserve the left most elements. I couldn't find a way to defeat this rule.

You could try MINSIZE as an attribute rather than SIZE. (But RHS clipping still seems to follow the same rules.)

You could create a dynamic layout that reads the size of the dialog and then sets the attributes or the elements.

_tom

Thanks for replying. As above SHRINK solved the immediate problem.
I did try MINSIZE on ftxt but it appears to have no effect on an IupText control.
I agree that MINSIZE on the IupDialog is probably the best/only way to prevent unwanted clipping.
What I have found, however, is that for some reason MINSIZE needs to be multiplied by {1.5,1.875}, ie width*1.5 and height*1.875.
For example (on an IupDialog) setting MINSIZE to "478x354" has the effect of 319x189, I needed "717x664" to achieve 478x354

Regards,
Pete

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu