Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Widgets - General questions or Mixed problems » Autocomplete droplist needed...
Autocomplete droplist needed... [message #16759] Thu, 10 July 2008 09:54 Go to next message
kbyte is currently offline  kbyte
Messages: 87
Registered: July 2008
Member
Hi all,

Is there any autocomplete droplist in Upp++?
If not, is it possible to create a win32 combobox in a upp window? I was thinking to use the win32 combo if it is autocomplete.
Could you provide me the code to make a win32 call to some win32 function?

Thank you

Kim
Re: Autocomplete droplist needed... [message #16760 is a reply to message #16759] Thu, 10 July 2008 10:27 Go to previous messageGo to next message
bytefield is currently offline  bytefield
Messages: 210
Registered: December 2007
Experienced Member
Auto-complete is provided by your code not by a widget and there isn't such a widget in Windows nor in U++. You have to inherit from DropList and overwrite Key function (and maybe Paint) and put your auto-complete code in it.

For WINAPI call simply add :: before you function ( ::MessageBox(hwnd, "", "", MB_OK); ). If you're trying to mix U++ with Windows, that's a bit harder because Windows widgets doesn't benefit of U++ positioning, sizing, etc.


cdabbd745f1234c2751ee1f932d1dd75
Re: Autocomplete droplist needed... [message #16762 is a reply to message #16759] Thu, 10 July 2008 11:11 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

kbyte wrote on Thu, 10 July 2008 03:54

Hi all,

Is there any autocomplete droplist in Upp++?
If not, is it possible to create a win32 combobox in a upp window? I was thinking to use the win32 combo if it is autocomplete.
Could you provide me the code to make a win32 call to some win32 function?

Thank you

Kim

Please use DropGrid - it's similar to DropList and has autosearch. It's not exactely the same what autocomplete but works very good for me. Just focus on DropGrid and start typing. Drop will open and scroll to first matched position (Matched letters will be highlighted). You can jump to the next position pressing F3. Enter close popup and select the focuces item.
Re: Autocomplete droplist needed... [message #16765 is a reply to message #16759] Thu, 10 July 2008 12:23 Go to previous messageGo to next message
kbyte is currently offline  kbyte
Messages: 87
Registered: July 2008
Member
Thats exactly what I need! Wink

Thank you uno and also to bytefield due to its example of win32 calling.

Kim
Re: Autocomplete droplist needed... [message #16767 is a reply to message #16759] Thu, 10 July 2008 13:24 Go to previous messageGo to next message
cas_ is currently offline  cas_
Messages: 20
Registered: July 2008
Location: Poland
Promising Member
Actually Win32 combobox is able to perform "find as you type" if you make its "SORTED" property true.

Anyway, I found some strange behavior of the DropGrid widget. If you look at the example images, you will notice that the first button to the left side of the DropGrid is always distorted by the usual dropdown icon (a small arrow pointing down), placed right in the middle of the button.

First image is the original DropGrid example, second one shows almost the same, but with the "select" button placed on the right hand side.
Re: Autocomplete droplist needed... [message #16769 is a reply to message #16767] Thu, 10 July 2008 14:18 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

cas_ wrote on Thu, 10 July 2008 07:24

Actually Win32 combobox is able to perform "find as you type" if you make its "SORTED" property true.

Anyway, I found some strange behavior of the DropGrid widget. If you look at the example images, you will notice that the first button to the left side of the DropGrid is always distorted by the usual dropdown icon (a small arrow pointing down), placed right in the middle of the button.

First image is the original DropGrid example, second one shows almost the same, but with the "select" button placed on the right hand side.

Thankz I'll check that. It's a linux, right (not a winxp theme) ?

[Updated on: Thu, 10 July 2008 14:21]

Report message to a moderator

Re: Autocomplete droplist needed... [message #16771 is a reply to message #16759] Thu, 10 July 2008 17:27 Go to previous messageGo to next message
cas_ is currently offline  cas_
Messages: 20
Registered: July 2008
Location: Poland
Promising Member
Yes, it was Ubuntu Hardy Heron. Windows version seems to be free from this bug.

Edit: On the other hand, there might be a rendering problem also on Windows Vista. DropGrid under Vista looks like this:

index.php?t=getfile&id=1259&private=0

All the buttons are flat and have a white background. At the same time, standard DropList is rendered like this:

index.php?t=getfile&id=1258&private=0

[Updated on: Thu, 10 July 2008 17:55]

Report message to a moderator

Re: Autocomplete droplist needed... [message #16772 is a reply to message #16771] Thu, 10 July 2008 18:13 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

as for 1st bug, I don't know why this code (part of MultiButton.cpp):
if(frm) {
	if(IsTrivial() && style->usetrivial)
		dopaint = false;
	ChPaint(w, x, border, cx, sz.cy - 2 * border,
	        dopaint ? v : style->trivial[st]);
}

on Linux draws background with arrow. Something to check by Mirek..
As for vista. I know. I discussed this with Mirek long time ago. First iteration of Multibutton drawn "real buttons". I don't have vista on my laptop so I can't try to "fix" multibutton. Ide droplist use different paint code. See find window.
Re: Autocomplete droplist needed... [message #16773 is a reply to message #16772] Thu, 10 July 2008 18:16 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

More about vista. I remeber that if mouse is over subbutton it is painted "as button". Maybe we should use "over" style always (in vista only ofcourse)?
Re: Autocomplete droplist needed... [message #16774 is a reply to message #16772] Thu, 10 July 2008 18:53 Go to previous messageGo to next message
cas_ is currently offline  cas_
Messages: 20
Registered: July 2008
Location: Poland
Promising Member
unodgs wrote on Thu, 10 July 2008 18:13


Ide droplist use different paint code. See find window.


Indeed, there is a template called WithDropChoice<> and it renders itself in a very similar way to what DropGrid looks like. So DropList (Multibutton) is the only exception here Smile Vista seems to render its "native" comboboxes in both ways, depending on where you check. For example, Explorer renders the white version, while ODBC source setup uses more button-like look.

[Updated on: Thu, 10 July 2008 18:54]

Report message to a moderator

Re: Autocomplete droplist needed... [message #16815 is a reply to message #16772] Sun, 13 July 2008 00:13 Go to previous messageGo to next message
cas_ is currently offline  cas_
Messages: 20
Registered: July 2008
Location: Poland
Promising Member
unodgs wrote on Thu, 10 July 2008 18:13

(part of MultiButton.cpp):
if(frm) {
	if(IsTrivial() && style->usetrivial)
		dopaint = false;
	ChPaint(w, x, border, cx, sz.cy - 2 * border,
	        dopaint ? v : style->trivial[st]);
}




This has something to do with Chameleon styles. If you add
v = style->lmiddle[st];

at line 319 of MultiButton.cpp (so you force Multibutton to use "lmiddle" instead of "left", whatever that means Wink), the arrow disappears.

UPDATE:

Bug is caused by the MultiButton::StyleFrame() properties, that are set up ChGtk.cpp, lines 1070 - 1080. Somehow, left[i] references an image with an arrow pointing down (I can't find exact place of such assignment though). Unfortunately, I know nothing about Chameleon and I have no idea how to fix it.

[Updated on: Sun, 13 July 2008 23:24]

Report message to a moderator

Re: Autocomplete droplist needed... [message #16823 is a reply to message #16815] Mon, 14 July 2008 23:53 Go to previous messageGo to next message
cas_ is currently offline  cas_
Messages: 20
Registered: July 2008
Location: Poland
Promising Member
Problem dissapears if I comment out line 928 of ChGtk.cpp (altough in this case left frame becomes a bit too thick):

DropList::Style& s = DropList::StyleFrame().Write();
GtkChImgWith(s.look, CtrlsImg::DA(), 1 * q, po);
GtkChImgWith(s.trivial, CtrlsImg::DA(), 1 * q, po);
// GtkChImgWith(s.left, CtrlsImg::DA(), 2 * q, po);
GtkChImgWith(s.right, CtrlsImg::DA(), 1 * q, po);
s.pressoffset = po;


This is because DropList::StyleFrame() and MultiButton::StyleFrame() are the same, so changing one of them will also change the other.

I still don't know what the correct solution would be and why is CtrlsImg::DA() used in so many contexts (actually I wonder about many different things in here but that's another story Wink).
Re: Autocomplete droplist needed... [message #16854 is a reply to message #16823] Thu, 17 July 2008 14:50 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Can you post a testcase, please? (I believe that line in ChGtk is there for a reason, so I would like to see the whole situation before removing it Smile

Mirek
Re: Autocomplete droplist needed... [message #16862 is a reply to message #16854] Thu, 17 July 2008 19:15 Go to previous messageGo to next message
cas_ is currently offline  cas_
Messages: 20
Registered: July 2008
Location: Poland
Promising Member
Sure I can!
In fact it took me quite a while to reproduce this behavior on a minimal example ("drop.AddTo( *this )" seems to be the key and it took me some time to figure that out). This is more or less what DropGrid does when it initializes itself:

#include <CtrlLib/CtrlLib.h>

using namespace Upp;

struct App : public TopWindow
{
	MultiButtonFrame drop;

	App()
	{
		SetRect( Size( 200, 25 ) );
		drop.AddTo( *this );
		drop.AddButton().Main();
		drop.SetStyle( MultiButtonFrame::StyleFrame() );
		drop.AddButton().Left().SetLabel( "Button" );
	}
};

GUI_APP_MAIN
{
	App().Run();
}


This results in a following window:

index.php?t=getfile&id=1264&private=0

By the way, I'm not saying that the line of code in ChGtk.cpp which I pointed in my last post, should be commented out; most likely it should stay as it is, I just don't know how Chameleon really works internally. I was just sharing the results of my efforts to resolve the bug and my post was only an example of this "work in progress" situation Smile
Re: Autocomplete droplist needed... [message #16875 is a reply to message #16774] Fri, 18 July 2008 21:39 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
cas_ wrote on Thu, 10 July 2008 12:53

unodgs wrote on Thu, 10 July 2008 18:13


Ide droplist use different paint code. See find window.


Indeed, there is a template called WithDropChoice<> and it renders itself in a very similar way to what DropGrid looks like. So DropList (Multibutton) is the only exception here Smile Vista seems to render its "native" comboboxes in both ways, depending on where you check. For example, Explorer renders the white version, while ODBC source setup uses more button-like look.


Well, in fact, I have observed (and reproduced, was quite hard work BTW, in fact the whole MultiButton class is dedicated to this purpose) this Vista rule:

If you can edit the content of field, buttons are white and become visible on hover.

Otherwise they are button-like - but in that case, the content is button-like too.

Mirek
Previous Topic: Can't Get DropGrid Working
Next Topic: FileList problems with extensions and pop-ups
Goto Forum:
  


Current Time: Thu Mar 28 18:13:17 CET 2024

Total time taken to generate the page: 0.01151 seconds