B4J Question PropertySheet control questions

m4.s

Member
Licensed User
Longtime User
1. The recently introduced PropertySheet control is very useful, but supports only a limited number of exposed methods, e.g. .ModeSwitcherVisible = True/False. So is there a way (likely using a native Java method call) to set a property sheet to display either in list or accordion mode? {Currently, it always defaults to the list mode (even when multiple categories have been defined via its meta map).}

2. Can additional field types be added (e.g. sliders, dropdown combobox, etc.)? Or will that possibly be coming in future B4J releases?

3. I see no way to set focus to a specific, or get focus of the current/active, property sheet field. Possible?

4. Since there are no exposed events, how can it be determined when a field value has changed in order to conditionally act on (e.g. save property selections and/or entries to a file, or update something else in UI as a direct result)? I've seen where someone used a timer to simply capture all field values every few seconds, but that seems quite inefficient when dealing with large and/or multiple property sheets.

*And, I've at least encountered a UI problem (bug?) when a property sheet has [meta map] .SetChoices fields -- as their dropdown listbox background color displays as transparent, albeit *only if/when* the property sheet is added to the app's main form (problem does not happen when it's added to a popup/secondary form). I can provide an example re: this if it's not been encountered/reported before.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. You can change the mode with this code:
B4X:
Dim jo As JavaObject = Sheet
jo.RunMethod("setMode", Array("CATEGORY"))
2. Not without modifying the library. Note the ChoiceBox is very similar to ComboBox.
3. Not possible.
4. That's true. This is a limitation of the underlying control.

*And, I've at least encountered a UI problem (bug?) when a property sheet has [meta map] .SetChoices fields -- as their dropdown listbox background color displays as transparent, albeit *only if/when* the property sheet is added to the app's main form (problem does not happen when it's added to a popup/secondary form). I can provide an example re: this if it's not been encountered/reported before.
Please upload an example.
 
Upvote 0

m4.s

Member
Licensed User
Longtime User
Hi Erel,

Apologies for my delay in replying back to your answers to my original questions posed in this thread here.

Re: #1, worked like a charm. :)

Re: #2-4, OK

But to my cited UI problem re: property sheet dropdown [.Choice] listbox backgrounds displaying as transparent, I JUST determined the culprit in my code: I am applying a CSS file to my main form in order to prevent selection highlighting of any ListView control within any of my form's panes:

.
.
.
udtAppGlobals.frmMain.Stylesheets.Add(File.GetUri(File.DirAssets, "app.css.txt"))
.
.
.​

with my app.css.text containing:

.list-view:focused {

-fx-background-color: transparent;
-fx-border-size: 0;

}

.list-cell {

-fx-background-color: transparent;
-fx-border-size: 0;

}​

The residual/undesired effect of this, however, is that the CSS is also applying to my property sheet dropdown listboxes (and to any of my ComboBox controls as well).

If/when I comment out the Stylesheets.Add line, my property sheet dropdown listbox (and ComboBox) UI transparency issue goes away. But, then, my unwanted ListView control selection highlighting occurs.

I've tried a number of approaches tonight to resolve this, yet to no avail. So can you please give me some suggestions? e.g. is there a way to disable or block ListView selection altogether (like EventData.Consume for other control mouse-clicking)?


Thanks again, in advance!
 
Upvote 0

m4.s

Member
Licensed User
Longtime User
Thanks Erel - as that worked perfectly; while also giving me the opportunity to refine my CSS:

#ListView .list-cell, .list-view {
-fx-background-color: transparent;
-fx-border-size: 0;
}

Note: I set all my application ListView controls' .Id property to same class name (as I want same behavior to apply to each).
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Note: I set all my application ListView controls' .Id property to same class name (as I want same behavior to apply to each).
It is better to use StyleClasses for this.
B4X:
ListView.StyleClasses.Add("MyListViewStyle")

B4X:
.MyListViewStyle .list-cell, .list-view {
-fx-background-color: transparent;
-fx-border-size: 0;
}
 
Upvote 0
Top