Default DrawStyle of Non-Material Design vs Material Design Controls
Posted: Thu Jan 30, 2020 2:56 am
Hi all.
We're working with the latest version of LANSA on a new project and have a couple of questions regarding the default appearance of Material Design vs non-Material Design controls. For the sake of simplicity in this post I'm going to use push buttons as an example.
With non-Material Design push buttons, when we drag and drop a #PRIM_PHBN from the controls palette onto a web page, by default the appearance of the button can be set if a DrawStyle with name #PushButton has been defined in the associated Theme. In this way, whenever we drag on a button we pick up the same appearance (with borders, mouseover effects etc etc). Note that the ThemeDrawStyle for these button is always blanks; the connection between the control and the default DrawStyle appears to be based on a "behind the scenes" cross reference (https://docs.lansa.com/14/en/lansa016/p ... e_name.htm). We can always "override" the default by entering a specific ThemeDrawStyle.
However with Material Design buttons (for example #PRIM_MD.RaisedButton) a different "default" approach appears to be used. Depending on the particular button chosen, a different ThemeDrawSyle is included. For example if the PRIMARY button is dragged onto a web page the default ThemeDrawStyle is "MediumTitle". If the Theme happens to contain a DrawStyle named "MediumTitle", then that will be used. If the specific button's ThemeDrawStyle is blanked out, then the #PushButton DrawStyle is not automatically picked up... so we're assuming that the "behind the scenes" connection between a #PRIM_PHBN is not there for a #PRIM_MD.RaisedButton.
So, my first question is... is that expected behaviour?
Therefore to create a "default" appearance for a #PRIM_MD.RaisedButton we could create a DrawStyle "MediumTitle" in the Theme as we know that this will always be used when we drag on the PRIMARY button from the controls palette. But we've noticed that "MediumTitle" is used elsewhere. For example #PRIM_MD.AppDrawer uses "MediumTitle" as its default ThemeDrawStyle. So if we were to define our "MediumTitle" DrawStyle as per our requirement for push button appearance, we would have to create another DrawStyle for any AppDrawers.
However some of the MD controls use combinations of DrawStyles. The #PRIM_MD.FlatButton has a default ThemeDrawStyle of "Borders1+BorderTheme500+ForegroundMediumPrimary" so it would become more complex to create our own override DrawStyle (as we would have to override 3 different DrawStyles and there is therefore a higher chance that these are used elsewhere and we would adveresely effect other controls).
I guess the simplest answer here is to create a new reusable, encapsulating a #PRIM_MD.RaisedButton (or #PRIM_MD.FlatButton, etc) and then we could set the ThemeDrawStyle to be a specific new DrawStyle that we have created in the Theme for that particular type of control. But then whenever we need to use a button we would have to go to the Repository, rather than the Controls palette to pick up the button. Also it doesn't appear that a #PRIM_MD component can be used as an ancestor so the reusable would have to be a #PRIM_PANL and therefore would not by default publish all relevant properties, events and methods.
Sorry for the long explanation... the question here is are we missing something? Is there a simple way to create a "default" Material Design button appearance which is always applied, i.e something similar to that which we see when working with non-Material Design controls?
Any suggestions, advice etc would be most appreciated.
Cheers for now.
Marcus.
We're working with the latest version of LANSA on a new project and have a couple of questions regarding the default appearance of Material Design vs non-Material Design controls. For the sake of simplicity in this post I'm going to use push buttons as an example.
With non-Material Design push buttons, when we drag and drop a #PRIM_PHBN from the controls palette onto a web page, by default the appearance of the button can be set if a DrawStyle with name #PushButton has been defined in the associated Theme. In this way, whenever we drag on a button we pick up the same appearance (with borders, mouseover effects etc etc). Note that the ThemeDrawStyle for these button is always blanks; the connection between the control and the default DrawStyle appears to be based on a "behind the scenes" cross reference (https://docs.lansa.com/14/en/lansa016/p ... e_name.htm). We can always "override" the default by entering a specific ThemeDrawStyle.
However with Material Design buttons (for example #PRIM_MD.RaisedButton) a different "default" approach appears to be used. Depending on the particular button chosen, a different ThemeDrawSyle is included. For example if the PRIMARY button is dragged onto a web page the default ThemeDrawStyle is "MediumTitle". If the Theme happens to contain a DrawStyle named "MediumTitle", then that will be used. If the specific button's ThemeDrawStyle is blanked out, then the #PushButton DrawStyle is not automatically picked up... so we're assuming that the "behind the scenes" connection between a #PRIM_PHBN is not there for a #PRIM_MD.RaisedButton.
So, my first question is... is that expected behaviour?
Therefore to create a "default" appearance for a #PRIM_MD.RaisedButton we could create a DrawStyle "MediumTitle" in the Theme as we know that this will always be used when we drag on the PRIMARY button from the controls palette. But we've noticed that "MediumTitle" is used elsewhere. For example #PRIM_MD.AppDrawer uses "MediumTitle" as its default ThemeDrawStyle. So if we were to define our "MediumTitle" DrawStyle as per our requirement for push button appearance, we would have to create another DrawStyle for any AppDrawers.
However some of the MD controls use combinations of DrawStyles. The #PRIM_MD.FlatButton has a default ThemeDrawStyle of "Borders1+BorderTheme500+ForegroundMediumPrimary" so it would become more complex to create our own override DrawStyle (as we would have to override 3 different DrawStyles and there is therefore a higher chance that these are used elsewhere and we would adveresely effect other controls).
I guess the simplest answer here is to create a new reusable, encapsulating a #PRIM_MD.RaisedButton (or #PRIM_MD.FlatButton, etc) and then we could set the ThemeDrawStyle to be a specific new DrawStyle that we have created in the Theme for that particular type of control. But then whenever we need to use a button we would have to go to the Repository, rather than the Controls palette to pick up the button. Also it doesn't appear that a #PRIM_MD component can be used as an ancestor so the reusable would have to be a #PRIM_PANL and therefore would not by default publish all relevant properties, events and methods.
Sorry for the long explanation... the question here is are we missing something? Is there a simple way to create a "default" Material Design button appearance which is always applied, i.e something similar to that which we see when working with non-Material Design controls?
Any suggestions, advice etc would be most appreciated.
Cheers for now.
Marcus.