![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Questions & Help Needed Post any question regarding Basic4ppc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
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? |
|
|||
|
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.
|
|
||||
|
You could probably use dzt's dzEventsMagic library to get the mouse position.
There is a similar example in the third page. dzEventsMagic |
|
||||
|
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 |
|
|||
|
Quote:
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. |
|
||||
|
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 |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
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 |