473,398 Members | 2,525 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,398 software developers and data experts.

ListBox -> DragListBox

Hi,

I'm trying to change a listbox into a draglistbox so that the items
can be arranged by the user. I found lots of examples on the web,
but all of them are different and since I've just started on C++
I don't really know what way is suitable for my program.

Here's some code :

// This is when the listbos is being called :

set_filterdlg_Hscroll(hDlg,TRUE);

// Next, the set_filterdlg_Hscroll :

// Used by FilterDlgProc() below for setting horizontal
// scroll bar settings.Does this based on the largest filter string.
// If add_flag == TRUE, add all filter strings to listbox also.
void set_filterdlg_Hscroll(HWND hDlg, BOOL add_flg)
{
TEXTMETRIC ftm;
HDC fdc;
int xch,xcaps, largest_filter_str=0, value, index;
char temp_str[256];

fdc = GetDC(hDlg);
GetTextMetrics(fdc, &ftm);
xch = ftm.tmAveCharWidth + ftm.tmExternalLeading;
xcaps = (ftm.tmPitchAndFamily & 1 ? 3 : 2) * xch / 2;
ReleaseDC(hDlg,fdc);

for (index = 0; index < Profile.filters.size(); index++)
{
Build_Filter_String(temp_str, Profile.filters[index]);
if(add_flg)
{
SendDlgItemMessage(hDlg, IDC_FILTERS, LB_ADDSTRING, 0, (LPARAM) ((LPCSTR) temp_str));
}

value = strlen(temp_str); // find largest str for h-scroll
if(value > largest_filter_str) largest_filter_str = value;
}

if(largest_filter_str)
{
value = (largest_filter_str * xcaps);
SendDlgItemMessage(hDlg, IDC_FILTERS, LB_SETHORIZONTALEXTENT,
(WPARAM) value, (LPARAM) 0);
}
else // if no filter strings to work from, set dummy value
{
SendDlgItemMessage(hDlg, IDC_FILTERS, LB_SETHORIZONTALEXTENT,
(WPARAM) 20, (LPARAM) 0);
}
}
I hope this is the right code where the content of the listbox is being build.
Who can tell me how to modify this into drag and drop?

Thanks in advance!

Bye, Peter Hunt (Holland)
Jul 19 '05 #1
5 3242
Peter Hunt wrote:
Hi,

I'm trying to change a listbox into a draglistbox so that the items
can be arranged by the user.


<snip>

http://www.slack.net/~shiva/welcome.txt

-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.

Jul 19 '05 #2
Kevin Goodsell <us*********************@neverbox.com> wrote:
I'm trying to change a listbox into a draglistbox so that the items
can be arranged by the user.
http://www.slack.net/~shiva/welcome.txt
Thanks for the welcome posting. But are you referring to something
in particular? My English probably isn't as good as most of you here,
but I couldn't find anything irregular...
-Kevin


Peter Hunt
Holland
Jul 19 '05 #3
Peter Hunt wrote:

Thanks for the welcome posting. But are you referring to something
in particular? My English probably isn't as good as most of you here,
but I couldn't find anything irregular...

Here's a few relevant passages:

*************
First of all, please keep in mind that comp.lang.c++ is a group for
discussion of general issues of the C++ programming language, as defined
by the ANSI/ISO language standard. If you have a problem that is
specific to a particular system or compiler, you are much more likely to
get complete and accurate answers in a group that specializes in your
platform. A listing of some newsgroups is given at the end of this post.
**************
A list of some Newsgroups :

Operating Systems
-----------------
comp.os.ms-windows.programmer.win32 MS/Windows: Mice, DLLs, hardware
***************

The point being that your post had nothing to do with the C++ language,
and is completely off-topic here.

Here's some more reading for you:

http://www.slack.net/~shiva/offtopic.txt

-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.

Jul 19 '05 #4
> The point being that your post had nothing to do with the C++ language,
and is completely off-topic here.
Well, as I told I'm new to programming... Since the code I pasted is
a part of a C++ program, I thought this might be the best place.

But I'll give it a try somewhere else. Thanks anyway.
-Kevin


Bye, Peter.
Jul 19 '05 #5
Peter Hunt wrote:
The point being that your post had nothing to do with the C++ language,
and is completely off-topic here.

Well, as I told I'm new to programming... Since the code I pasted is
a part of a C++ program, I thought this might be the best place.

But I'll give it a try somewhere else. Thanks anyway.

-Kevin

Bye, Peter.


Many C++ programs contain platform specific functionality.
Yours is one. The platform specific functionality is not
discussed in this newsgroup. That functionality is a
Windows Listbox control. Other platforms, such as vending
machines and microwave ovens, don't support Windows
features (have you seen a Listbox on a vending machine?).

We discuss issues with the _standard_ C++ language in
this newsgroup.

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book
http://www.sgi.com/tech/stl -- Standard Template Library

Jul 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: amber | last post by:
Hello. Can someone tell me what I may be doing wrong here? I'm using the code (lboxRP is a listbox): Dim newRPindex As Integer newRPindex = Me.lboxRP.FindString(RP)...
3
by: Paul T. Rong | last post by:
I have a listbox (of product names) control on my form. I want to pass the selected item (a product name) to a subform, and the product unitprice should apear automatically next to the product name...
8
by: Oddball | last post by:
Ok - I have a ListBox control and I'm ready to write my own DrawItem event handler. What I want to draw as the item is another control. I have created a user control that I would like to list in...
2
by: collie | last post by:
Hi, I have 2 listboxes. The first gets populated from the db as soon as the page loads. The second listbox get populated based on the user's selection from the first listbox. However,...
6
by: Chris Leuty | last post by:
I am populating a multiselect Listbox from a dataset, with the content of the listbox filled by one table, and the selections determined from another table. So far, I have been keeping the dataset...
1
by: yamne | last post by:
I have a problem. When I click in edit datagrid button I show two listbox and two button. I use two button to move data between two listbox. My problem is that I can't call the listbox in the...
7
by: Dave | last post by:
Hi all, After unsuccessfully trying to make my own dual listbox control out of arraylists, I decided to look for a 3rd party control. I've looked for over a week now and can't find anything but...
3
by: Ali Chambers | last post by:
Hi, I have created a listbox called "dtlist1" on my VB.NET form. I call a procedure as follows: Private Sub openfile(flname As String) dtlist1.Items.Clear() etc..
1
by: Sunray | last post by:
I have a form called the sales form and i have 2 sets of listboxes So what happens is. i add items form the bottom set of list boxes which are bound to a data base to the top set of list boxes which...
5
by: Academia | last post by:
(If you've seen this in the drawing NG, sorry. I inadvertently sent it there.) I have a listbox populated with Objects. The Class has a String field that ToString returns. I assume that...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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.