piradoiv / xojo-web-badges

Bootstrap's Badges for (almost) any Web2 visual control
MIT License
7 stars 4 forks source link

Consistency issue over the fields #1

Open vdhub opened 3 months ago

vdhub commented 3 months ago

Hello,

Is there a ways to keep consistency over the fields ?

For example i have the text fields which render properly but i have the Datepickers which show somewhere at the middle of the control Screenshot 2024-05-29 at 07 55 42

Thanks

piradoiv commented 3 months ago

Hi @vdhub! How are you creating those fields? Could you please upload a sample project?

vdhub commented 3 months ago

Hello Ricardo,

I wanted my badges to be above the field so what i did i changed this to adapt the location

`Var classes() As String = Array("xojo-badge", "d-flex", "p-2", _ "border", "border-light", "bg-" + indicator) classes.Add(If(caption.Length < 2, "rounded-circle", "rounded-pill"))

Var topOffset As Integer = 20 Var topVal As Integer

topVal = top + topOffset

Var styles() As String = Array("height: 21px", "font-size: 10px", "align-items: center", "color: white", "position: absolute", "top: " + topVal.ToString + "px", "right: " + Right.ToString + "px", _ "z-index: 10")

If caption = "" Or caption = " " Then caption = " " Var html As String = "<span class=""" + String.FromArray(classes) + _ """ style=""" + String.FromArray(styles, ";") + """>" + caption + ""

Var js() As String js.Add("$('#" + control.ControlID + " .xojo-badge').remove();") js.Add("$('#" + control.ControlID + "').append(" + html + ");") control.ExecuteJavaScript(String.FromArray(js)) `

apparently while doing that it shifted the badges for the text fields on the right location but messed up the DatePicker .

Now the Badges look ok when you don't have Caption on the fields but if you add that then it seems that the badge is getting rendered on the top of the caption side hence overlapping with the previous field

So this is your code with Caption on the fields Screenshot 2024-05-30 at 22 42 16

So it would be nice if , let's sau it would allow to shift the badge based on the type of the field and i guess With or without Caption on it, as usually you want to show that either your style cutting little bit the field or above the field .

The latest web fonts are huge honestly and it takes few controls to fill the screen while we need to fit the proper functionality in it.

So as a workaround i guess i could disable the captions on the fields and use some labels but that will defeat the purpose of the field, when you have the caption, why not use it, at least this is how i see it.

Thanks