View Co-ordinates

Tom Law

Active Member
Licensed User
Longtime User
I am attempting to overlay a label (part of a self made datagrid) with an edittext control by copying the screen coordinates i.e.:

Dim TB As EditText
TB.Initialize ("Main")
Activity.AddView(TB, Comment0.Left, Comment0.Top, Comment0.Width, Comment0.Height)

(where Comment0 is an existing label)

Unfortunately this is not working with the edittext appearing about 15mm higher up the screen and 2mm to the left. I suspect that this may be because the views are held in a tabhost control - does this change the left and top coordinates and how do I correct them? :sign0104:


Tom
 

Tom Law

Active Member
Licensed User
Longtime User
Thanks Klaus - that sounds like it should do the trick - but how do I access the parent property in code?

Tom
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Where and how did you add the Label?
If it was in the Designer you know its parent view with the Parent property.
If it was by code, it's the view in ParentView.AddView(...
Example:
Activity.AddView(...
Panel1.AddView(...

Best regards.
 
Upvote 0

Tom Law

Active Member
Licensed User
Longtime User
The parent of Comment0 (label) is Activity.

I have tried using:

Activity.AddView(TB, Comment0.Left, comment0.Top, Comment0.Width, Comment0.Height)

But that does'nt seem to work - the EditText is still not over the label.


Tom
 
Upvote 0

Tom Law

Active Member
Licensed User
Longtime User
You are definately on the right track though, the edittext is visible on all pages of the tabhost - obviously it needs to be assigned to a specific page - but how do I do that in code?
 
Upvote 0

Tom Law

Active Member
Licensed User
Longtime User
Cheers Klaus - But go easy on me - it's my first project.

I have placed a spare datafile in files in case it doesnt transfer. The service details page is the one causing the problem, click on the second field (top line) in the grid. A red edit text should appear over the label. Instead it appears higher up (it is also visible on other pages of the tabhost).

Tom
 

Attachments

  • S8Mobile.zip
    44 KB · Views: 133
Upvote 0

klaus

Expert
Licensed User
Longtime User
Hi Tom,
Here you are.
I added the EditText to the 'page3' layout and set Visible = False.
It is necessary to add the EditText to the layout file because its real parent view, the internal Panels of the TabHost, are not directly available.

Best regards.
 

Attachments

  • S8Mobile_1.zip
    44.1 KB · Views: 157
Upvote 0

Tom Law

Active Member
Licensed User
Longtime User
Hi Tom,
Here you are.
I added the EditText to the 'page3' layout and set Visible = False.
It is necessary to add the EditText to the layout file because its real parent view, the internal Panels of the TabHost, are not directly available.

Best regards.

Cheers Klaus and thank you for looking at this for me. Yes I had considered the option of adding an invisible control (although the solution was one that I was trying to avoid). Would you know whether there are any plans to expose the internal tabcontrol pages in a future upgrade?


Tom
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
...(although the solution was one that I was trying to avoid)
Why ? I would use this solution.


Would you know whether there are any plans to expose the internal tabcontrol pages in a future upgrade?
Sorry, I don't know, but I don't think so.

You could have a look at the TabHostExtra library, perhaps the getTabHeight method could be s asoluton. I haven't tested it, perhaps there are some frame pixels and those would shurely be different on different devices.

Best regards.
 
Upvote 0
Top