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 » ArrayCtrl, HeaderCtrl & GridCtrl » Is it possible to ebmed Ctrl into row (not cell) inside ArrayCtrl?
Is it possible to ebmed Ctrl into row (not cell) inside ArrayCtrl? [message #26340] Mon, 26 April 2010 10:55 Go to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

index.php?t=getfile&id=2499&private=0
Re: Is it possible to ebmed Ctrl into row (not cell) inside ArrayCtrl? [message #26343 is a reply to message #26340] Mon, 26 April 2010 11:51 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
#include <CtrlLib/CtrlLib.h>
using namespace Upp;

template <class T>
struct WithForcedHorz : public T
{
	virtual void Layout() {
		Rect r = GetRect();
		Size sz = GetParent()->GetSize();
		r.right = sz.cx - r.left;
		SetRect(r);
		T::Layout();
	}
};

GUI_APP_MAIN
{
	TopWindow wnd;
	ArrayCtrl ctrl;
	WithForcedHorz<DropList> list;
	
	ctrl.AddColumn("Item").Edit(list);
	ctrl.AddColumn("Data");
	for (int i = 0; i < 9; i++) {
		String s = Format("Item %d", i+1);
		ctrl.Add(s, i);
		list.Add(s, s);
	}
	wnd << ctrl.SizePos();
	wnd.SetRect(Size(300, 400));
	wnd.CenterScreen().Sizeable();
	wnd.Run();	
}

Easy Smile
Re: Is it possible to ebmed Ctrl into row (not cell) inside ArrayCtrl? [message #26345 is a reply to message #26343] Mon, 26 April 2010 13:45 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

mrjt, thank you very much for quick answer. But I'm afraid your example is not exactly what I wanted.
I try to embed Ctrl on regular basis (not as editing Ctrl, but as Ctrl that is seen even if row is not selected/edited). So I changed your example a bit to use ArrayCtrl::SetCtrl() instead of ArrayCtrl::Column::Edit().
#include <CtrlLib/CtrlLib.h>
using namespace Upp;

template <class T>
struct WithForcedHorz : public T
{
	virtual void Layout() {
		Rect r = GetRect();
		Size sz = 300;
		SetRect(0,2,300,r.Height());
		T::Layout();
	}
};

GUI_APP_MAIN
{
	TopWindow wnd;
	ArrayCtrl ctrl;
	WithForcedHorz<DropList> list[9];
	
	ctrl.AddColumn("Item");
	ctrl.AddColumn("Data");
	for (int i = 0; i < 9; i++) {
		String s = Format("Item %d", i+1);
		ctrl.Add(s, i);
		ctrl.SetCtrl(i, 0, list[i]);
		ctrl.SetLineCy(i, list[i].GetRect().Height()+2);
	}
	wnd << ctrl.SizePos();
	wnd.SetRect(Size(300, 400));
	wnd.CenterScreen().Sizeable();
	wnd.Run();	
}

And it looks like embedded control is cropped by cell ractangle (that is in fact good behaviour). It looks like there is no way to embed Ctrl this way, so I'll try to set custom Display for my row and emulate needed control.
Re: Is it possible to ebmed Ctrl into row (not cell) inside ArrayCtrl? [message #26346 is a reply to message #26340] Mon, 26 April 2010 13:57 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
No, cell spans are not supported in ArrayCtrl.

Mirek
Re: Is it possible to ebmed Ctrl into row (not cell) inside ArrayCtrl? [message #26808 is a reply to message #26340] Sun, 30 May 2010 18:04 Go to previous messageGo to next message
bernz is currently offline  bernz
Messages: 4
Registered: February 2010
Location: Philippines
Junior Member
index.php?t=getfile&id=2565&private=0

can you please help me find the code for this, esp. the search function
  • Attachment: Untitled.jpg
    (Size: 223.89KB, Downloaded 463 times)
Re: Is it possible to ebmed Ctrl into row (not cell) inside ArrayCtrl? [message #26811 is a reply to message #26808] Sun, 30 May 2010 21:31 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
You can start here: CtrlLib/FileSep.cpp: 1629
Previous Topic: App crashes when remove rows in WhenChangeRow-callback
Next Topic: Problem - GridCtrl::Get(int,int) with DropTree
Goto Forum:
  


Current Time: Thu Apr 18 19:56:43 CEST 2024

Total time taken to generate the page: 0.02445 seconds