Source language: Translate to:

Resize contains of Grid

Questions about our Advanced Database plug-in

Moderator: Neosoft Support

Resize contains of Grid

Postby smartmedia » Sat Sep 10, 2011 2:44 pm

Hi..

I want the contains of grid to automatically resized in width when my application goes from normal window to maximum or resized. Any ideas.???

Thanks
User avatar
smartmedia
 
Posts: 889
Joined: Fri Apr 01, 2005 6:50 am
Location: Hellas

Postby Neosoft Support » Mon Sep 12, 2011 11:10 am

Do you mean automatically change the column widths?

You could try placing your grid rectangle inside a container object. Then use the container's resize action to alter the column widths to match the width of the grid.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby smartmedia » Mon Sep 12, 2011 11:25 am

Hi..

Dave, how this will work automatically..???
OK i use dbpGetGridClientInfo to get the width, but what i will do after...??
In need a factor or something to calculate the fields, and because not all fields are equal how i will increase only a present according to final width..???
Can u give me an example with code..

Thanks
User avatar
smartmedia
 
Posts: 889
Joined: Fri Apr 01, 2005 6:50 am
Location: Hellas

Postby Neosoft Support » Mon Sep 12, 2011 11:44 am

I suppose you could assign a percentage value to each field and use that to calculate each width. For example:

Code: Select all
dbpGetGridClientInfo "AddrBook" "Contacts" "[cw]" "[ch]"

.set last name, first name and company fields to 10%...
SetVar "[LastNameW]" "[cw]*0.1"
SetVar "[FirstNameW]" "[cw]*0.1"
SetVar "[CompanyW]" "[cw]*0.1"
.set street field to 20%...
SetVar "[StreetW]" "[cw]*0.2"
.set city field to 10%...
SetVar "[CityW]" "[cw]*0.1"
.set statefield to 5%...
SetVar "[StateW]" "[cw]*0.05"
.set country field to 10%...
SetVar "[CountryW]" "[cw]*0.1"
.set comments field to 25%...
SetVar "[CommentsW]" "[cw]*0.25"
.all should add up to 100%

dbpSetColumnWidths "AddrBook" "Contacts" "FirstName=[FirstNameW];LastName=[LastNameW];Company=[CompanyW];Street=[StreetW];City=[CityW];State=[StateW];Country=[CountryW];Comments=[CommentsW]"
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby smartmedia » Mon Sep 12, 2011 2:01 pm

Hi..

Thanks Dave, the example was very good. Instead of SetVar i used Math in order to cut the decimals from the numbers.
Math "[cw]*0.05" "0" "[Resize5]

This is major tip and solve many problems.
Thanks again.
User avatar
smartmedia
 
Posts: 889
Joined: Fri Apr 01, 2005 6:50 am
Location: Hellas


Return to NeoBookDBPro

Who is online

Users browsing this forum: No registered users and 1 guest

cron