Languages

Menu
Sites
Language
How to center Button "Normal Bitmap"

Hi,

If we have image which size is smaller than button size, and this image is our normal bitmap (or pressed bitmap) of button control how to center it?

There are only X and Y normal bitmaps parameters, but this is quite poor idea if this is only option to give fixed padding sizes.

 

Native webbrowser application have bottom panel with buttons and images on these buttons are smaller than button sizes (and X Y parameters are 0), so is it possible to do it from the code?

----------------------

By the way... why while making ContextMenu and using Tizen::Ui::Controls::ContextMenuAnchorDirectionCONTEXT_MENU_ANCHOR_DIRECTION_UPWARD gives downward direction, and CONTEXT_MENU_ANCHOR_DIRECTION_DOWNWARD gives UPWARD ? (Tizen 2.0 SDK)

 

Best regards

Edited by: Brock Boland on 17 Mar, 2014 Reason: Paragraph tags added automatically from tizen_format_fix module.

Responses

12 Replies
Pushpa G
You can scale the bitmap to the size of the button using the API result Tizen::Graphics::Bitmap::Scale ( const Dimension & dim ) of class Bitmap. Refer to https://developer.tizen.org/help/topic/org.tizen.native.apireference/classTizen_1_1Graphics_1_1Bitmap.html
Michał
But with that solution I have to load bitmaps from the code, because when I make it from XML and UI Builder there is no possibility to get this Bitmap from Button (or am I wrong?). Like I said, in Native Browser icons/bitmaps in bottom bar are centered in some other way, or it will be poor solution to load that BMP using UI Builder and then load them from code once again... -
tizendevteam T
Hi michal, The issue w.r.t contextmenuanchordirection is reproducible, this issue has been forwarded for internal development team
Michał
By the way, why SetPosition() from editor is still visible if it is doing nothig (it's from Bada...) and new should be SetAnchorPosition()...
Pushpa G
@michal: you can add bitmap to a button via Native UI Builder also and align it to the button. Check UiControls sample app available in Tizen IDE->File->Tizen Native Project->Sample->UiControls Open UiControls Project in Project explorer->res-> screen-size-normal->IDF_FORM_BUTTON.xml and check the Normalbackground button’s code in the xml:
Michał
Please don't get me wrong... I know how to use UI Builder and what Normal Background Bitmap attribute is, normal background attribute is scaling to the size of the button... In emulator of 2.0 version is Native Browser app (kmcele1k0n) which have main layout "IDL_FORM.xml" And now i will paste you xml of BACK BUTTON code in bottom bar panel, to show you what i'm talking about: -------------
Michał
XML CODE: in link http://imageshack.us/a/img832/7776/backkc.png because i can't paste xml...
Pushpa G
ok, is it possible for you to attach your sample app here so that i can test it and check
Michał
It is not possible, you can download all Native Browser files (resources like graphics/layouts) using running emulator and "Connection explorer" but i have no idea what's going on in c++ code of that app... I just copy their xml form and resources, and when I run it it is top left aligned... So i'm interested how they centered it...
Michał
Link to IDL_FORM.xml file http://przeklej.net/download.php?file_id=92072
Pushpa G
The enumeration makes sense if you consider the anchor as the starting point. From that point, when a ContextMenu is created in the upward direction, then the arrow would be pointing down, at the point of origin
Pushpa G
Hi michal, And w.r.t Bitmaps alignment, change the values for the properties 'Normal Bitmap X' and 'Normal Bitmap Y' for the buttons to make the bitmaps aligned to center. Adjust the values as Normal Bitmap X = (Width of button - Height of Image) /2 Normal Bitmap Y = (Height of button - Height of Image) /2 Similarly Pressed Bitmap values, Highlighted Bitmap values and Disabled Bitmap values can be modified to align the bitmaps to center.