Repositioning tool doesn't place button where I left it

this is what I'm trying to achieve
I want to be able to place the text over an image relative the actual location of the source sensor location

the underlying image is a floorplan or blueprint of an actual building.

the building floorplan will not always be the same so the text will need to be relocated.

also the number of sensor values being displayed will vary

In this example, i just made 8 new buttons. and let the app decide their default location upon creation.
I then dragged them , saved them, cleared screen and recalled them

next as a test I am going to attempt to do this without saving, just hard code in the locations and go from there, this will eliminate translation error


in its simplest form, it seems to work reliably.

i will scour my save routine and see if I can find an error

I overlooked something here.
screen size matters. the field for the buttons is about 400x600
the far right button should be about halfway down the screen
it appears that the movement it to the device screen size , not the app screen size.
the screen size displayed is from screen1.height and width

by those dimensions the components seem to be near expected position

here I have a mostly stable app, except the buttons don't stay where I put them.
I have test labels to show the whole file before writing and after reading which are daisy chained with AFTER SAVING BLOCK.

The top scroll views show the list of data when opened and before saving

Im now getting correctly the values back that i saved, and the xy is written in the button text, but the position of the button is clearly not what's written ON the button

ive included the relevant blocks and the aia

Rooster22.aia (196.5 KB)



RoosterConfig.txt (797 Bytes)

Try this one Rooster24.aia (208.5 KB)

Also change this because I forgot

1 Like

it works well.
it returns to the saved position

can the disparity between the object and the touch be lessened?

I cant drag an object to top of screen because of it. yes, it was like that before, also. as a work around, I can manually set the position or tweak it in the setup page

I uploaded screencast but you cant see my cursor so didn't illustrate much

many thank yous for helping.
it looks like you modified the extension not the body of my blocks so much.
aside from my blocks being elementary, there were no errors in blocks?

I found a few issues in my blocks that need to be cleaned up.
I have to go to work for a few hours.

I will post again after i get it cleaned up. When I look at the details of each button , im seeing the default xy not the saved xy.

this is a good time to thoroughly clean up.

Thank you so much for your help.

I got my housekeeping done.
now the app will not compile

next issue: seems the last button made before displaying is corrupt and subsequent adds do not appear.


Rooster25.aia (144.3 KB)

Try this one Rooster25b.aia (145.2 KB)

1 Like

I'm away from desk. Will be back in 30 minutes or so

working smoothly it seems
there is still a glitch with the last button. i will clean up my blocks this evening and test as much as i can.
i will be afk for a few hours

Thank you again!

You could also try this approach:

buttonPosition1.aia (26.5 KB)

I have used CompCreator instead of Dynamic Components, and KIO4_Move instead of Repositioning Tools. The only downside is that to "register" a button to move, you have to press it once, then press again and hold to move it. You have to do this each time. Last position of a button is always saved.

More of a proof of concept than anything else.

Credits @Kevinkun and @Juan_Antonio for their extensions.

thank you for the fresh ideas
how the buttons move isnt too big a deal as it only happens during an initial set up. daily use typically would not involve that.

I think Boban has modified an existing extension to make it work??? im not really sure what happened there.

@TIMAI2 i will check this out and see how it works.

Thank you!

Edit: i like how you used the length of list as the index number of the buttons, efficient!

@Boban everything is working smoothly at the moment. I will continue to test it as I add to my project

Can I save this aix from my project or can you pm it to me?

Ive gotten this a few times when connecting companion. Dont know source.

Runtime Error
Error from Companion: java.lang.RuntimeException: invalid syntax in eval form: :1879:1: caught exception in inliner for # - java.lang.RuntimeException: no such class: io.mohamed.repositioningtools.RepositioningTools gnu.bytecode.ObjectType.getReflectClass(ObjectType.java:179) gnu.bytecode.ClassType.getModifiers(ClassType.java:103) gnu.bytecode.ClassType.isInterface(ClassType.java:471) gnu.expr.InlineCalls.checkType(InlineCalls.java:56) gnu.expr.InlineCalls.visit(InlineCalls.java:49) gnu.expr.InlineCalls.visitSetExpValue(InlineCalls.java:363) gnu.expr.InlineCalls.visitSetExpValue(InlineCalls.java:28) gnu.expr.ExpVisitor.visitSetExp(ExpVisitor.java:114) gnu.expr.InlineCalls.visitSetExp(InlineCalls.java:369) gnu.expr.InlineCalls.visitSetExp(InlineCalls.java:28) gnu.expr.SetExp.visit(SetExp.java:406) gnu.expr.ExpVisitor.visit(ExpVisitor.java:55) gnu.expr.InlineCalls.visit(InlineCalls.java:46) gnu.expr.InlineCalls.visitBeginExp(InlineCalls.java:272) gnu.expr.InlineCalls.visitBeginExp(InlineCalls.java:28) gnu.expr.BeginExp.visit(BeginExp.java:156) gnu.expr.ExpVisitor.visit(ExpVisitor.java:51) gnu.expr.InlineCalls.visit(InlineCalls.java:46) gnu.expr.InlineCalls.visitBeginExp(InlineCalls.java:272) gnu.expr.InlineCalls.visitBeginExp(InlineCalls.java:28) gnu.expr.BeginExp.visit(BeginExp.java:156) gnu.expr.ExpVisitor.visit(ExpVisitor.java:51) gnu.expr.InlineCalls.visit(InlineCalls.java:46) gnu.expr.InlineCalls.visitLetExp(InlineCalls.java:317) gnu.expr.InlineCalls.visitLetExp(InlineCalls.java:28) gnu.expr.LetExp.visit(LetExp.java:207) gnu.expr.ExpVisitor.visit(ExpVisitor.java:51) gnu.expr.InlineCalls.visit(InlineCalls.java:46) gnu.expr.InlineCalls.visit(InlineCalls.java:28) gnu.expr.LambdaExp.visitChildrenOnly(LambdaExp.java:1664) gnu.expr.LambdaExp.visitChildren(LambdaExp.java:1651) gnu.expr.InlineCalls.visitScopeExp(InlineCalls.java:279) gnu.expr.InlineCalls.visitLambdaExp(InlineCalls.java:349) gnu.expr.InlineCalls.visitLambdaExp(InlineCalls.java:28) gnu.expr.LambdaExp.visit(LambdaExp.java:1640) gnu.expr.ExpVisitor.visit(ExpVisitor.java:55) gnu.expr.InlineCalls.visit(InlineCalls.java:46) gnu.expr.InlineCalls.visit(InlineCalls.java:28) gnu.expr.ExpVisitor.visitAndUpdate(ExpVisitor.java:161) gnu.expr.ExpVisitor.visitExps(ExpVisitor.java:175) gnu.expr.ApplyExp.visitArgs(ApplyExp.java:415) gnu.kawa.reflect.CompileInvoke.validateApplyInvoke(CompileInvoke.java:23) java.lang.reflect.Method.invoke(Native Method) gnu.expr.InlineCalls.maybeInline(InlineCalls.java:467) gnu.expr.QuoteExp.validateApply(QuoteExp.java:150) gnu.expr.ReferenceExp.validateApply(ReferenceExp.java:191) gnu.kawa.functions.CompilationHelpers.validateApplyToArgs(CompilationHelpers.java:66) java.lang.reflect.Method.invoke(Native Method) gnu.expr.InlineCalls.maybeInline(InlineCalls.java:467) gnu.expr.QuoteExp.validateApply(QuoteExp.java:150) gnu.expr.ReferenceExp.validateApply(ReferenceExp.java:191) gnu.expr.InlineCalls.visitApplyExp(InlineCalls.java:119) gnu.expr.InlineCalls.visitApplyExp(InlineCalls.java:28) gnu.expr.ApplyExp.visit(ApplyExp.java:410) gnu.expr.ExpVisitor.visit(ExpVisitor.java:55) gnu.expr.InlineCalls.visit(InlineCalls.java:46) gnu.expr.QuoteExp.validateApply(QuoteExp.java:162) gnu.expr.ReferenceExp.validateApply(ReferenceExp.java:191) gnu.kawa.functions.CompilationHelpers.validateApplyToArgs(CompilationHelpers.java:66) java.lang.reflect.Method.invoke(Native Method) gnu.expr.InlineCalls.maybeInline(InlineCalls.java:467) gnu.expr.QuoteExp.validateApply(QuoteExp.java:150) gnu.expr.ReferenceExp.validateApply(ReferenceExp.java:191) gnu.expr.InlineCalls.visitApplyExp(InlineCalls.java:119) gnu.expr.InlineCalls.visitApplyExp(InlineCalls.java:28) gnu.expr.ApplyExp.visit(ApplyExp.java:410) gnu.expr.ExpVisitor.visit(ExpVisitor.java:51) gnu.expr.InlineCalls.visit(InlineCalls.java:46) gnu.expr.InlineCalls.visitBeginExp(InlineCalls.java:272) gnu.expr.InlineCalls.visitBeginExp(InlineCalls.java:28) gnu.expr.BeginExp.visit(BeginExp.java:156) gnu.expr.ExpVisitor.visit(ExpVisitor.java:51) gnu.expr.InlineCalls.visit(InlineCalls.java:46) gnu.expr.InlineCalls.visit(InlineCalls.java:28) gnu.expr.LambdaExp.visitChildrenOnly(LambdaExp.java:1664) gnu.expr.LambdaExp.visitChildren(LambdaExp.java:1651) gnu.expr.InlineCalls.visitScopeExp(InlineCalls.java:279) gnu.expr.InlineCalls.visitLambdaExp(InlineCalls.java:349) gnu.expr.InlineCalls.visitLambdaExp(InlineCalls.java:28) gnu.expr.ExpVisitor.visitModuleExp(ExpVisitor.java:103) gnu.expr.ModuleExp.visit(ModuleExp.java:482) gnu.expr.ExpVisitor.visit(ExpVisitor.java:51) gnu.expr.InlineCalls.visit(InlineCalls.java:46) gnu.expr.InlineCalls.inlineCalls(InlineCalls.java:33) gnu.expr.Compilation.walkModule(Compilation.java:994) gnu.expr.Compilation.process(Compilation.java:1965) gnu.expr.ModuleInfo.loadByStages(ModuleInfo.java:330) gnu.expr.ModuleExp.evalModule1(ModuleExp.java:238) gnu.expr.ModuleExp.evalModule(ModuleExp.java:198) gnu.expr.Language.eval(Language.java:943) gnu.expr.Language.eval(Language.java:883) gnu.expr.Language.eval(Language.java:865) com.google.appinventor.components.runtime.util.AppInvHTTPD.serve(AppInvHTTPD.java:190) com.google.appinventor.components.runtime.util.NanoHTTPD$HTTPSession.run(NanoHTTPD.java:489) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) java.lang.Thread.run(Thread.java:919)

Sorry I got that error as well, it wasn't easy to manipulate the extension manually as v2 and v3 was made differently and involved many strange things when updating from v2 to v3

Nevertheless, aia taken from post 16 is updated correctly now..

Rooster30a.aia (144.3 KB)

awesome!

TY!

the issue from 25a resurfaced here in 30a
the last button is narrowed and subsequent buttons not displayed.

Also, as i was on 28, i tried to delete the old extension and import the new but it wouldnt connect to companion, it stalled at 50% loading the extension, so i went version 30b and began to retrace my mods from that point.

a new project with new extension loaded with no issue.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.