Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


Using calendars with a table control


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-24-2008, 09:12 AM
Junior Member
 
Join Date: Sep 2007
Posts: 28
Default Using calendars with a table control

Hello all,

I'm looking for a way to get a calendar to pop up near the cell that is clicked on a table. A quick way to enter a date in that cell. I know the cell that is clicked but can't find a way to get the x,y coordinates to position the calendar object near the cell. I can't even use the cell to calculate a position because the table is scrollable.

Any ideas?
Reply With Quote
  #2 (permalink)  
Old 01-24-2008, 09:29 AM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Switzerland
Posts: 707
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

Hello kolbe
You can get the Top, Left, Width and Height values from your Table control and calculate the Top, Left values for the Calender object.

Best regards
Klaus
Switzerland
Reply With Quote
  #3 (permalink)  
Old 01-24-2008, 12:00 PM
Junior Member
 
Join Date: Sep 2007
Posts: 28
Default

Thanks Klaus but I'm afraid I still don't understand how this will allow me to position the calendar in reference to the cell selected. The idea is that the calendar appears where you click on the table. Knowing the cell doesn't help because the position on the screen is relative due to the fact that you can scroll the table... the cell could be anywhere within the visible part of the table. Basically I think I need a mousedown event for the table control that returns an x,y coordinate.
Reply With Quote
  #4 (permalink)  
Old 01-24-2008, 12:25 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,199
Default

You could probably use dzt's dzEventsMagic library to get the mouse position.
There is a similar example in the third page.
dzEventsMagic
Reply With Quote
  #5 (permalink)  
Old 01-24-2008, 09:56 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Switzerland
Posts: 707
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

Bonsoir Kolbe,
I have never used dzt's dzEventsMagic library. Try it, other wise I see only the way below to calculate the optimum position.
You know the selected cell
so you what column and what row.
Knowing the row height and the different column widths it is possible to know the cell coordinates.
Then knowing the size of the calendar object, you can calculate it's optimum position.
Je sais, ce n'est pas si simple mais pas si complqué non plus.
Sorry thats our common language.
It's not that simple but not that complicated either.

Meilleures salutations
Klaus
Switzerland
Reply With Quote
  #6 (permalink)  
Old 01-24-2008, 10:25 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,343
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

Is you app a desktop or a device app?
If it is a device app, why try to pop-up a calendar? use a panael and meke it visible when you need it...
The same aplies to the desktop, but in that case I can understand why you need to calculate the position, but is there any harm to always show the calendar control in the same position?...
Still calculating the vertical position is fairly easy...
imagine that your table is 50 lines high, and you only show 10..
the minimum of the srollbar is 1 and the max is 50, but the step, if set to 5, gives you a way to know wich of the 10 visible lines were cliked...
so on table select you can check wich line was selected, and (assuming they all have the same height) divide the used screen by the table, by the number of lines shown, minus the multiple of the height of the line index, minus the scrollbar step....pfuuuiuu.....

it's better thought than put in words, but if you can visualize what i'm saying, it gets clearer...
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing
Reply With Quote
  #7 (permalink)  
Old 01-25-2008, 07:26 AM
Junior Member
 
Join Date: Sep 2007
Posts: 28
Smile

Quote:
Originally Posted by klaus View Post
Bonsoir Kolbe,
I have never used dzt's dzEventsMagic library. Try it, other wise I see only the way below to calculate the optimum position.
You know the selected cell
so you what column and what row.
Knowing the row height and the different column widths it is possible to know the cell coordinates.
Do we know the row height? I see a table.colwidth but that is it. No table.rowheight that I can see... table.height is the height of the whole table.

Cableguy, I tried doing what you suggest but because the table scrolls, partial rows may be displayed and you don't get discreet places for your rows. Originally I had the calendar appearing the same spot but when actually using the program on a daily basis it get very annoying!

I've tried the EventsMagic library and that works well. When the dzevent fires I store the x,y in a global. Then when the table.selectionchanged event fires (luckily after the dzevent) I know where to draw the calendar. There is still an issue if the cell is close to the edge of the screen but that can be worked out.

Thanks for all the suggestions.
Reply With Quote
  #8 (permalink)  
Old 01-25-2008, 09:38 AM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Switzerland
Posts: 707
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

Hello kolbe
Yes there is no RowHeight in the table control, but the height is given and remains constant, the user cannot change it. So you can count its height in pixels and use this value. The ColumnWidth can be changed by the user so you must retreve them. But, as you say, the dzEventsMagic works well it is probably easyer to use it rather than to calculate the coordinates. The advatage of the calculation could be the fact that the calendar would be aligned with the cell and not at the mouse position somewhere in the cell, but this is a quetion of taste.
The problem when the cell is near the right edge can be checked in looking if the mouse position x + Caledar1.With>Table.Width or the Form.Width and if yes set the x value to x= Table.Width-Caledar1.With
If the calendar is near the bottom edge its the same but with the Heights y + Caledar1.Height>Form.Height and if yes set the y value to y= Form.Height-Caledar1.Height.
Using Calender1.Height is OK you don't nead to take into account the height of the open calendar it opens below or above depending on the remaining space.

I tried this calculation in one of my programs with a table, it works. If you are intersted in, I can post it to you.

Best regards
Klaus
Switzerland
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
table control copy/paste robert black Questions & Help Needed 4 10-16-2008 08:57 PM
Table Control what can be done scott93727 Share Your Creations 0 06-22-2008 05:39 AM
For the Table Control alfcen Basic4ppc Wishlist 1 11-08-2007 04:19 PM
Question about table control EzCoder Questions & Help Needed 2 10-26-2007 11:16 AM
Scroll bar on Table control HARRY Questions & Help Needed 1 05-11-2007 10:08 AM


All times are GMT. The time now is 05:43 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0