Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combox doesn't allow Y placement at the top #3795

Open
ddyer0 opened this issue Mar 11, 2024 · 2 comments
Open

Combox doesn't allow Y placement at the top #3795

ddyer0 opened this issue Mar 11, 2024 · 2 comments

Comments

@ddyer0
Copy link
Contributor

ddyer0 commented Mar 11, 2024

The whole way ComboBox works is bizarre, and it's basically impossible to clone
and modify it as a whole, because it uses internal variables and apis that are not
available outside of package com.codename1.ui

It's also impossible to override the "center y" functionality that's built in. I'd like
my menus to top up at the top of the frame. Short of reworking the whole thing,
a simple change can provide the "menu at top" functionality.

In "showPopupDialog" add a boolean centerMenu and this clause

	            if(listH < formHeight) {
	                // pop up or down?
	            	if(centerMenu)
	            	{
	            		if(top > formHeight / 2) {
	                        bottom = formHeight - top;
	                        top = top - listH;
	                    } else {
	                        top +=  getHeight();
	                        bottom = formHeight - top - listH;
	                    }
	            	}
	            	else {
	            		// leave top at the top
	            		bottom = formHeight - top - listH;
                                if(bottom<0) { top += bottom; bottom = 0; }
	            	}
	            }

Also noted; the various Max(x,0) clauses when calling popupDialog.show
are not coordinated, so if any of them fire the presented menu is damaged.

The "ComboDialog" created by createPopupDialog is never shown. AFAIK
it is used as a container for an underlying list which is presented by popupDialog.show

@shai-almog
Copy link
Collaborator

Yes. It's an old and fragile component. We suggest avoiding it: https://www.codenameone.com/blog/tip-dont-use-combobox.html

@ddyer0
Copy link
Contributor Author

ddyer0 commented Mar 12, 2024

Sure, and I'm not suggesting a rewrite - more like one more barnacle on the old hull.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants