![]() |
|
|||||||
| 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 |
|
|||
|
I'm currently working on a form that will have a scrolling list of records but each record can have different types of information. I plan on creating panels on the fly, one panel per record; filling them with labels, which may even be multiline; then using the ControlsEx scrollbar to adjust the .top of each panel (as well as .height and .show/.hide) to simulate a scrolling list.
The problem I'm having is that I need to be able to click anywhere on these panels to select one record which will then go to another form for editing that record. My initial ideas were to create a button over each panel set to transparent so that the underlying labels would show, or to make the labels disabled and use the click event of the underlying panel to detect a click. Neither of these seem work. Lastly, I thought of trying to detect a generic click and comparing the x/y positions with the bounds of all the displayed panels but I can't find a way to do this either. Failing these options, I could change every label into a button and hook the click event of every button and the underlying panel into the same function but this seems a bit of overkill for what I'm trying to do. Anyone have any other ideas? This is for use on a PPC running WM6. Thanks in advance. |
|
|||
|
I believe you can detect the x/y coordinates by using the door library (see e.g. this thread: get x,y when over control)
An alternative which I have used is to actually only employ a small number of labels with fixed positions, and just change the content of the labels instead of actually creating a large number of labels/panels. all the best / Björn |
|
|||
|
Quote:
This is a good idea and I might use it in another part of my program but it won't work in this case. Here, some of my records contain only 1 label while others can have as many as 20 on multiple lines. |
|
|||
|
I had set this problem aside while I worked on some other things, but now that I've come back to it, I found a solution. So for anyone who needs something similar, here it is.
Using dzEventsMagic, I hooked event #512 (WM_MOUSEFIRST) then simply read off the lParam when the event is fired. lParam is a 4 byte value where the low 2 bytes are the X coord and the high 2 bytes are the Y coord. This will detect a "click through" of an enabled label on the form/panel that is hooked. (Note that the desktop version will detect a click through only if the label is DISABLED, while the device version will detect on ENABLED labels only) Code:
' Create a form "form1" including a panel "panel1" and a label "label1"
' label1 should be parented to panel1 and placed inside panel1
Sub App_Start
' dzem is a dzEventsMagic object
dzem.New1("Panel1", true)
dzem.Hook(512) 'WM_MOUSEFIRST
Form1.Show
End Sub
Sub dzem_MagicEvent
'yes i know this is ugly, should use bitwise functions
label1.Text = Int(dzem.lParam/65536,0) & " x " & dzem.lParam-Int(dzem.lParam/65536,0)*65536
End Sub
Sub Form1_Show
End Sub
Sub Form1_Close
dzem.Unhook(512)
End Sub
Clicking on the panel (or the label) will show the clicked coordinates within the panel. (Again, note that if on the desktop, the label must be DISABLED for this to work properly. On the device, the label must be ENABLED) So back to my original problem. I can simply make a panel for each "row" of data, fill it with appropriate labels, and hook the entire panel to detect clicks on that panel. Then move/hide the panels as necessary based on the scrollbar and I now have a custom made scroll box. |
![]() |
| 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 |
| detect shift, alt and ctrl keys | micro | Questions & Help Needed | 7 | 07-30-2008 09:05 AM |
| Detect ActiveSync connection | Lasse | Questions & Help Needed | 2 | 07-27-2008 09:51 AM |
| How to detect which is PPC and PPC Phone? | conf | Questions & Help Needed | 6 | 07-31-2007 07:09 PM |
| How to detect whether SIP is active / not? | belotrei | Questions & Help Needed | 5 | 06-01-2007 05:22 PM |
| GPS Port Auto Detect | derez | Share Your Creations | 0 | 05-12-2007 07:38 PM |