Adjusting Command Bar to Match Padding Changes [Solved]

At present, it looks as if changes to the left and right custom padding for a display window are not carried through to the command bar. Anyone have a workaround (apart from sticking to default padding!)?


Quest calls a function called ResetCommandBarFormat every turn, to make sure that changes to the current text style and background colour are applied to the command bar as well. This will override any formatting you set on the command bar directly.

The default implementation of the function is:

  <function name="ResetCommandBarFormat">
    format = GetCurrentTextFormat("") + ";background:" + game.defaultbackground
    game.commandbarformat = format
    JS.setCommandBarStyle(format)
  </function>

It may be possible to get the effect you want by replacing this function with one which sets the desired padding as well; or by using your UI Initialisation script to modify the JS function setCommandBarStyle.


Thanks mrangel, I should have added that I'd like a workaround for this bug that will work with the online editor (I'm helping someone who doesn't use Windows). The online editor doesn't allow core functions such as ResetCommandBarFormat to be redefined. What would be involved in changing setCommandBarStyle?


Hmm… My CSS isn't that good. But that would be my first guess.

The default JS function looks like this:

function setCommandBarStyle(style) {
    var width = $("#txtCommand").width();
    $("#txtCommand").attr("style", style);
    $("#txtCommand").width(width);
}

So my first guess would be changing it to something like:

setCommandBarStyle = function(style) {
    var width = $("#txtCommand").width();
    $("#txtCommand").attr("style", "foo: 99; bar: 22;" + style);
    $("#txtCommand").width(width);
};

(replacing "foo: 99; bar: 22;" with the actual CSS properties you want to set)

In Quest code, ready to be included in the UI Initialisation script, that would translate to something like:

JS.eval("setCommandBarStyle = function(s) {var w = $('#txtCommand').width();$('#txtCommand').attr('style', 'foo: 99; bar: 22;' + s).width(w);};")

Thanks again mrangel,
The command bar is currently in the right position on the left but is too long. If w is an integer could I just use the value I want in place of w?

JS.eval("setCommandBarStyle = function(s) {$('#txtCommand').attr('style', s).width(900);};")

I'm really just guessing here!


...actually that does work. Should have just tried it before replying!

The width that works is: 950 - 2*(padding + 10).

...which also needs to be reduced by the width of game panes, if used (180).


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums