473,405 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

combobox property in MFC

A combobox having property DropDown .

i want change this property to Droplist and back to Dropdown depending upon

a situation .

i use the function modifyStyle() but it not working.

can any body help me ?
thanks in advance
Sachin
Aug 21 '08 #1
6 5831
Banfa
9,065 Expert Mod 8TB
I do not believe you can make this style change once the combo box has been created because I think that the box actually has to be created in the correct manor.

There are a number of styles that are fixed at the time the control is created and I think this is one of them.

To get the functionality you want rather than changing the style try destroying the combo box and re-creating it with the new list style.
Aug 21 '08 #2
yeah ..

i try for that ...


my code is

void save::OnBnClickedButton1()

{
RECT windowExtents;
combobox.GetWindowRect(&windowExtents);
combobox.DestroyWindow();
combobox.Create(WS_EX_NOPARENTNOTIFY|WS_CHILD|WS_V ISIBLE|WS_VSCROLL|CBS_DROPDOWNLIST,windowExtents,t his,1);
combobox.ShowWindow(SW_SHOW|SW_SHOWNORMAL);
}

if i do this way then my combobox is gone .
Aug 21 '08 #3
Banfa
9,065 Expert Mod 8TB
This is because combobox.GetWindowRect returns the combo boxes top left and bottom right corner co-ordinates in screen coordinates but combobox.Create expects the top left of the combo box plus is size and width defined in client co-ordinates of the parent dialogue.

You will have to process the co-ordinates returned by combobox.GetWindowRect before passing them to combobox.Create probably using DialogBox.ScreenToClient.
Aug 21 '08 #4
ok i will try fir that one more thing is that

i am passing "this" pointer to combobox.Create() function.

before that i am calling combobox.DestroyWindow(); method

and this change my "this" pointer content .

this is might be one reason that ?

is any way to preserve "this" pointer.
Aug 21 '08 #5
This is because combobox.GetWindowRect returns the combo boxes top left and bottom right corner co-ordinates in screen coordinates but combobox.Create expects the top left of the combo box plus is size and width defined in client co-ordinates of the parent dialogue.

You will have to process the co-ordinates returned by combobox.GetWindowRect before passing them to combobox.Create probably using DialogBox.ScreenToClient.
yeah ..

its working properly

but only problem is that after we convert combobox style from droplist to dropdown and try to insert any text inside it text is BOLD form and font size is also big

is any way to reduce this problem
Aug 22 '08 #6
Banfa
9,065 Expert Mod 8TB
but only problem is that after we convert combobox style from droplist to dropdown and try to insert any text inside it text is BOLD form and font size is also big
Erm, now that is just wierd. If you look there should be a way to set the font for a control you could try that.
Aug 22 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Zlatko Matić | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the...
7
by: NCrum | last post by:
I want to set the Default value of a Combobox for any changeable record and have got this working but it is totaly unsatisfactory see the code below I loop through the items in the Combo looking...
2
by: Don | last post by:
I've looked high and low for some code that will allow me to have a combobox with a flat borderstyle. I found a few examples, but nothing that was really usable for me. I had the following...
30
by: dbuchanan | last post by:
ComboBox databindng Problem == How the ComboBox is setup and used: My comboBox is populated by a lookup table. The ValueMember is the lookup table's Id and the DisplayMember is the text from a...
5
by: Eric A. Johnson | last post by:
Hi Everyone, I am at my wit's end here. I have a combobox (combyQueryTitle) that I need to use in order to select a query for my database project. Therefore, I am using the...
6
by: Roberto | last post by:
Hi, using vb 2005 I'd like to have a combobox in READONLY mode, like I have for textbox. Combobox only has enabled property. When I turn this property false I can not select the text in the...
0
by: Frnak McKenney | last post by:
Can I use a bound ComboBox for both browsing and editing? I'm working on a small, standalone database application using Visual C#.NET 2003 and an Access data file. In order to keep the number...
5
by: active | last post by:
I tried to use a datasource with a combobox and it didn't work completely so I build a small test that was much more straight forward then the app. The test was to see if the combobox dropdown...
5
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
I want to create a customized ComboBox where the methods ComboBox.Items.Add and ComboBox.Items.Insert will behave thusly: -- If the item is not present, add it. -- If the item is present, set the...
4
by: Jerad Rose | last post by:
I'm baffled by this -- is there not a typed object used for ComboBox Items? Best I can tell, all of the methods for ComboBox that accept an Item are of type Object. Why in the world is a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.