Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
18 user(s) are online (13 user(s) are browsing Forums)

Members: 0
Guests: 18

more...

Support us!

Headlines

 
  Register To Post  

boopsi: how to make button with 2 lines with centered text in ?
Home away from home
Home away from home


See User information
For some design reassons i need to make button with 2 lines of text, both of which should be centered and looks like usual button.

For first i simple tried "\n" for the button.gadget's GA_Text : it simple didnt' work, and \n treatet as fancy character.

Then, Javier point me out that we may try this way : create label.image object with LABLE_Text (this one handle \n fine), and then, attach it to a button:

twolinesimage IIntuition->NewObject(NULL"label.image",
        
LABEL_Text"Replace All\nin All Tabs",
        
LABEL_JustificationLJ_CENTER,
        
TAG_END);
...
        
LAYOUT_AddChildIIntuition->NewObject(NULL"button.gadget",
            
GA_Imagetwolinesimage,
            
TAG_DONE),
...


While it more or less work, it have 2 issues :
1). LABEL_Justification, LJ_CENTER, for the Label object with \n seems do not work. So text looks not centered.
2). When we press on this "button", it acts not like usual button visually, but bring some background.

So question is : how to make a 2 lines button , which looks like button, and press like button (even if it will be not real button), and have centered text in.

Thanks!

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: boopsi: how to make button with 2 lines with centered text in ?
Home away from home
Home away from home


See User information
Put the justification before the text.

Use a similar label with alternate colours for the select image.

Go to top
Re: boopsi: how to make button with 2 lines with centered text in ?
Just can't stay away
Just can't stay away


See User information
Try to use:

LABEL_Text"Replace All\n in All Tabs ",


with blank spaces at start + end of 2nd line, seems to work ¿:-/

Still have the "color" issue when clicking.

EDIT1: seems both lines are almost same width in pixels, maybe how label.image do the justification calculation has some flaws.
EDIT2: color "issue":
LAYOUT_AddChildNewObject(NULL"button.gadget",
            
//GA_Text, "Replace in all tabs",
            //BUTTON_Justification, BCJ_CENTER,
            
BUTTON_RenderImageOBJ(OID_REPLACE_ALL_TABS),
            
BUTTON_SelectImageOBJ(OID_REPLACE_ALL_TABS),
            
TAG_END),


Edited by jabirulo on 2025/6/16 14:28:16
Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project