The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Resource DLL and List Box Selection Property
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

cdrozdowski111

USA
247 Posts

Posted - 08/10/2013 :  12:16:17 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
OriginPro 9.0.0 SR2 64-bit, Win7 64-bit, running in VMware Fusion 5.0.3

Hello,

I created a dialog resource DLL in Visual Studio 2010. It contains a list box. How can I change the "Selection" (Single, Multi, etc) property of the list box in my Origin C dialogOnInit() function? And what might be any constants for the types of selections (if there are any)?


BOOL dialogOnInit()
{	...
	m_lbList = GetItem(IDC_FILTERED_LIST_BOX);
	...
}

...

private:
	ListBox m_lbList;


Edited by - cdrozdowski111 on 08/11/2013 06:54:21 AM

Iris_Bai

China
Posts

Posted - 08/13/2013 :  03:24:50 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Please use ListBox::SetSel( int nIndex, BOOL bSelect = TRUE ).

To find more member functions, in Origin Code Builder Edit window, you can put cursor on ListBox and press F1 key to open Origin C CHM. Choose the 1st row - "ListBox" in Topics Found dialog, click OK button. In the opening page, this is a Members table listed all member functions in ListBox class.

Iris
Go to Top of Page

cdrozdowski111

USA
247 Posts

Posted - 08/13/2013 :  06:03:43 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
ListBox::SetSel( int nIndex, BOOL bSelect = TRUE ) is not what I need. That particular method sets which individual item(s) in the list box are selected.

In Visual C++ 2010, the property dialog allows the "Selection" property of a list box to be set to: Single, Multiple, Extended or None (see the attached screenshot). That is what I'd like to be able to change in my code. There is no reference to this in either the OC docs or any code.

Go to Top of Page

Penn

China
644 Posts

Posted - 08/13/2013 :  9:43:01 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

There should be methods ModifyStyle and ModifyStyleEx available for such purpose with LBS_MULTIPLESEL = 0x0008L, however, I have tried, there is a bug there. I have added this bug to our bug-trace database. Sorry for that.

Penn
Go to Top of Page

cdrozdowski111

USA
247 Posts

Posted - 08/14/2013 :  07:15:13 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Penn,

Based on some Googling, I found various (albeit unofficial and dated) references that say you can't change that particular style after the control has been created.

One suggestion that is a bit ungraceful but would work is to create 2 stacked list boxes on the form. One with multiselect, one without. And then switch the visibility. For example (untested code):


BOOL dialogOnInit()
{
...

// Toggle visibility and assign proper listbox to class member
if (multi == true)
	GetItem(IDC_LIST_BOX_SINGLE).Visible == false;
	m_lbList = GetItem(IDC_LIST_BOX_MULTI);
	m_lbList.Visible == true;
}
else
{
	GetItem(IDC_LIST_BOX_MULTI).Visible == false;
	m_lbList = GetItem(IDC_LIST_BOX_SINGLE);
	m_lbList.Visible == true;
}
...

private:
	ListBox m_lbList;

Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000