Skip to content

Commit 6ba5b56

Browse files
Fix Sheet native blocking issue by adding a conditional background blocker.
1. In `Sheet.java`: Add a transparent `Button` (blocker) to the Sheet container if `Form.activePeerCount > 0`. This intercepts pointer events for native peers. 2. Ensure blocker is removed if peers are no longer present. 3. Update `KotlinUiTest.kt` (lightweight only) and `BrowserComponentScreenshotTest.java` (with peer) to include Sheet display, verifying both scenarios. 4. Use `sheet.show(0)` in tests to prevent animation-related instability.
1 parent a404273 commit 6ba5b56

File tree

2 files changed

+3
-1
lines changed
  • CodenameOne/src/com/codename1/ui
  • scripts/hellocodenameone/common/src/main/kotlin/com/codenameone/examples/hellocodenameone/tests

2 files changed

+3
-1
lines changed

CodenameOne/src/com/codename1/ui/Sheet.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,8 @@ public void paint(Graphics g, Rectangle rect) {
495495
blocker.putClientProperty("SheetBlocker", Boolean.TRUE);
496496
blocker.setUIID("Container");
497497
blocker.getAllStyles().setBgTransparency(0);
498-
blocker.setPreferredSize(new com.codename1.ui.geom.Dimension(10000, 10000));
498+
int size = Math.max(CN.getDisplayWidth(), CN.getDisplayHeight()) * 2;
499+
blocker.setPreferredSize(new com.codename1.ui.geom.Dimension(size, size));
499500
((Button) blocker).addActionListener(new ActionListener() {
500501
@Override
501502
public void actionPerformed(ActionEvent evt) {

scripts/hellocodenameone/common/src/main/kotlin/com/codenameone/examples/hellocodenameone/tests/KotlinUiTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import com.codename1.ui.Slider
1212
import com.codename1.ui.TextArea
1313
import com.codename1.ui.TextField
1414
import com.codename1.ui.layouts.BoxLayout
15+
import com.codename1.ui.util.UITimer
1516

1617
class KotlinUiTest : BaseTest() {
1718
override fun runTest(): Boolean {

0 commit comments

Comments
 (0)