How to center an sc_ajax_message ?

All is in the title :slight_smile: Thank you !

I ask this question because I have a long form with a long scrollbar and when I click on update message (on top of screen), the wait, error or confirmation messages are vertically aligned to the center … so it’s hidden for users.

I found a workaround : sc_ajax_message that I can not center horizontally now… So I would like to know if someone has an idea to center it.

Thank you

Just an attempt: did you try adding html code in the message? I havent tried it but it seems likely that this is translated by the browser and hence alignment should work./
<div align=“center”>my text</div>

See also: http://www.w3schools.com/tags/att_div_align.asp

:frowning: no way ! thanks ! an other idea ?

OK, are you ready for this? Here we go.

Go to Tools -> Layout -> Themes. If you haven’t done it yet choose your theme and click on ‘Save as’ , give it a name and save.
Click on ‘Advanced mode’.
Open Folder ‘Message’.
Mark the element ‘Message’.
Select the option ‘center’ from the drop down field ‘Horizontal Alignment’ and hit the ‘Save’ button.

Go to your application under Layout -> Settings. Reload the themes and apply the newly created theme to your app.

That’s it.

jsb

Hello jsbinca,
Thank you very much for these explanations, but, it has had no effect. I did it differently, by overriding the native “scCenterElement” js function like that :

echo "<script language=‘JavaScript’>
function scCenterElement(oElem)
{
var ".chr(36)."oElem = $(oElem),
".chr(36).“oWindow = $(this),
iElemTop = 200,
iElemLeft = Math.round((”.chr(36)."oWindow.width() - ".chr(36)."oElem.width()) / 2);

".chr(36)."oElem.offset({top: iElemTop, left: iElemLeft});

} // scCenterElement
</script>";

It works perfectly, with what I wanted to do. This thread is solved for me.
Thank you again

nb : chr(36) is for “$” character

Hi

From my works on sc, themes sometimes doesn’t apply correctly, I see it even got worse in v8 :frowning:

However, my 2 cents will be to make express edit and re-chose the modified theme, then in layout, make sure to press that refresh button, after that make a hard reload to your broswer… if works that is good, if doesn’t then try to change some other elements in the theme, note that themes (CSS) are very detailed, sometimes you have to try many things to work, such as page, table, label, and there there is background for each one, and also for each app like form/ grid… each one is alone!

cheers

put inside a css div and code… margin: 0 auto;

more about centering elements in CSS

Darren