setColumnWidth and getColumnWidth UPDATED getColumnWidth

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
reifsnyderb
Posts: 45
Joined: Wed Oct 29, 2008 6:03 pm

setColumnWidth and getColumnWidth UPDATED getColumnWidth

Post by reifsnyderb »

Hello,

I have been working with columns and while the setColumnWidth method works fine, why isn't there a getColumnWidth method?

Regards,

Brian
Last edited by reifsnyderb on Sun Mar 06, 2011 3:53 am, edited 1 time in total.
reifsnyderb
Posts: 45
Joined: Wed Oct 29, 2008 6:03 pm

Post by reifsnyderb »

Ok, I think the following lines of code will work if added to CGUITable.cpp

u32 CGUITable::getColumnWidth(u32 columnIndex)
{
if(columnIndex >= 0 && columnIndex < (u32)columns.size() )
{
return (u32)columns[columnIndex].width;
}
return 0;
}



However, here is the problem: I can't get Irrlicht to compile and my irritation is that I have so many hours an evening to work on my program and I really don't have time to sit down and hack Irrlicht too.

Any help will be greatly appreciated. I am using VC 2005 and Irrlicht is installed under d:\irrlicht\working\ I have the original installed under d:\irrlicht\irrlicht-1.7.2

Don't get me wrong. Irrlicht is a great library and I really like it. I am just frustrated.

Thanks,

Brian
reifsnyderb
Posts: 45
Joined: Wed Oct 29, 2008 6:03 pm

Post by reifsnyderb »

Ok, I just got Irrlicht to compile. I loaded fresh sources. :oops:

I had this happen before and I thought I had everything straightened out...I guess not. :evil:

I'll have to see if I can add the 8 lines of code. :roll:


Regards,

Brian
reifsnyderb
Posts: 45
Joined: Wed Oct 29, 2008 6:03 pm

Post by reifsnyderb »

Ok, the following works great!


u32 CGUITable::getColumnWidth(s32 columnIndex) const
{
if(columnIndex >= 0 && columnIndex < (s32)columns.size() )
{
return (u32)columns[columnIndex].width;
}
return 0;
}


Of course, the two header files need updated as well. Now, is there a chance to get this included in the next release of Irrlicht? :D

Regards,

Brian
random
Posts: 158
Joined: Wed Aug 11, 2010 6:01 am

Post by random »

question:

in this line

Code: Select all

if(columnIndex >= 0 && columnIndex < (s32)columns.size() ) 

Code: Select all

(s32)columns.size() 

//or

(s32)Columns.size() 
reifsnyderb
Posts: 45
Joined: Wed Oct 29, 2008 6:03 pm

Post by reifsnyderb »

Hello,

Thanks for pointing that out. I re-typed it, on another computer, to post it. "Columns" should be capitalized. It also occurred to me that there may be a theoretical possibility of wanting to set a column to 0 so maybe a -1 should be returned if the column doesn't exist.

i.e.

[code]
s32 CGUITable::getColumnWidth(s32 columnIndex)
{
if(columnIndex >= 0 && columnIndex < (s32)Columns.size() )
{
return (u32)Columns[columnIndex].width;
}

return -1;
}
[/code]

Regards,

Brian



[quote="random"]question:

in this line

[code]if(columnIndex >= 0 && columnIndex < (s32)columns.size() ) [/code]

[code](s32)columns.size()

//or

(s32)Columns.size() [/code][/quote]
reifsnyderb
Posts: 45
Joined: Wed Oct 29, 2008 6:03 pm

Post by reifsnyderb »

Hello,

It looks like it will be added to the trunk:

http://irrlicht.sourceforge.net/phpBB2/ ... 385#245385


Also, it appears that returning 0 is fine after all.

Regards,

Brian
Post Reply