Solved User made command button that can be moved with mouse? (1 Viewer)

mounty76

Registered User.
Local time
Today, 08:40
Joined
Sep 14, 2017
Messages
341
haha! We got plenty of liferafts!

Thanks MajP, is working good. Attached is idea of the jobs pane. I think when a new dot is moved to the plan/deck then it would ideally open up a new record/job for this new dot that has been added, this would highlight as a new job in the jobs detail pane whereby you can enter the specifics of the job, also when choosing the priority for it to update this in the priority box in the job record? Finally in a perfect work when you click on an existing dot it opens up the corrosponding job detail for that dot. Hope that makes sense!
 

Attachments

  • DynamicButtonsV2.accdb
    5.2 MB · Views: 54

MajP

You've got your good things, and you've got mine.
Local time
Today, 11:40
Joined
May 21, 2018
Messages
8,529
I am still working this, needed to do a lot of clean up. As mentioned this was just a proof of concept and not designed to be easily modified for other uses. I am trying to make this more flexible so you can add and modify images without having to do a lot of redesigning of the form. I hard wired a lot of stuff.

These are all pretty much done.
1. I think when a new dot is moved to the plan/deck then it would ideally open up a new record/job for this new dot that has been added, this would highlight as a new job in the jobs detail pane whereby you can enter the specifics of the job,
2. also when choosing the priority for it to update this in the priority box in the job record?
3. Finally in a perfect work when you click on an existing dot it opens up the corresponding job detail for that dot. Hope that makes sense!
 

Mike Krailo

Well-known member
Local time
Today, 11:40
Joined
Mar 28, 2020
Messages
1,044
That's pretty much what I was thinking as well MajP. What was the other project that you worked on that used this concept? I thought I seen something about pets in the comments.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 11:40
Joined
May 21, 2018
Messages
8,529
What was the other project that you worked on that used this concept?
See thread #4 for the original discussion

In Access 2016, I could not reproduce the drag and drop gesture easily, it required a few tries.
It is a little temperamental. You have to ensure the item is clicked. Which is a little problematic without firing the double click event.
I think instead of having to drag the item I will use a right click and pop up menu. Then you can right click and choose the priority at the same time. The drag seems to work better for some reason on a dot already over the image.

It's worth mentioning the placing of the items is resolution-dependent.
I mentioned that previously. I would have to do a lot more work, but I think that would be doable. I am guessing the item could be saved with the resolution it was added. Then have a scale factor. I know @isladogs has some scaling code I would have to look at.

This is interesting as a potential concept, but would need a lot more work to actually share with someone as a working solution.

Getting closer though. See how this works. Should be able to associate the job information as requested.
 

Edgar_

Active member
Local time
Today, 10:40
Joined
Jul 8, 2023
Messages
430
You have to ensure the item is clicked
As long as it has the bounding box, I can move it. Would that mean focus? not sure, without inspecting your code too much, I tried setting focus to the control in your mouse down event and function, but Access said it could not move the focus, so I desisted for now.

In A2016, it looks more stable now,in A2021, it still not working.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 11:40
Joined
May 21, 2018
Messages
8,529
As long as it has the bounding box, I can move it. Would that mean focus? not sure, without inspecting your code too much, I tried setting focus to the control in your mouse down event and function, but Access said it could not move the focus, so I desisted for now.

In A2016, it looks more stable now,in A2021, it still not working
For me on 2016 and 365 it is a little temperamental but not a problem. It seems if it does not work on the first attempt to drag it always works on the second. I think that could be a problem in how I coded this. I have a click event on each item to initialize the MoveableImage class. I think the first drag causes the initialization. That is why it works on the second attempt.

I see that I made a collection class, but never really used it. I think I was thinking about adding all hidden images into the collection class to avoid this constant instantiation and maybe solve this problem.
 

Mike Krailo

Well-known member
Local time
Today, 11:40
Joined
Mar 28, 2020
Messages
1,044
I added an error handler for that annoying error that occurs in SaveItemToTable (Error 2467: The expression you entered refers to an object
that is closed or doesn't exist) when you decide to go into design view for the form. Also the code doesn't compile anymore because of missing sub GetJobIDFromFloorPlan. It was only being used in the Test sub so I commented that line out as well and it compiles now.

There is some sort of bug with saving the priority and position of the circles. I tried to create a new job on the Bridge deck and dragged the circle to the back of the boat. Assigned the job and priority of Next Season (Purple). Then when selecting the Profile floor plan and later going back to the bridge deck, the circle I had positioned moved towards the middle of the boat somewhere (not where I originally put it). The priority also reverted back to Unassigned.

Edit: I tested this further and it's really weird, the job I assigned on the bridge deck only moves as stated above if I move or nudge an existing job on say the Profile floor plan. Then my job on the bridge deck moves and assumes the priority color of that last circle that I moved on the Profile. Can't quite figure out what's going on.
 

mounty76

Registered User.
Local time
Today, 08:40
Joined
Sep 14, 2017
Messages
341
HI MajP, sorry for the delay in reply, been a hectic couple of days. Is looking good, I'm not seeing the issues the that Mike is. With placing a new dot/job if you click once on the dot then click again and move it then it works fine, this must be a focus thing I think? The other feature that would be great would be if you could apply a filter for department and priority so that only the dots appear for the filter applied?
 

Mike Krailo

Well-known member
Local time
Today, 11:40
Joined
Mar 28, 2020
Messages
1,044
HI MajP, sorry for the delay in reply, been a hectic couple of days. Is looking good, I'm not seeing the issues the that Mike is. With placing a new dot/job if you click once on the dot then click again and move it then it works fine, this must be a focus thing I think? The other feature that would be great would be if you could apply a filter for department and priority so that only the dots appear for the filter applied?
Try this to duplicate what I am seeing.
  1. Select any deck plan that is not the Profile such as the Lower Deck.
  2. Single click the dot in upper left corner to select it and initialize the image.
  3. Drag dot to location that is in the rear of the boat.
  4. Fill out the details for the job. Make sure you make it high priority (Red Color).
  5. Select the Profile view of the boat.
  6. Click one of the Unassigned dots already on the Profile view (Grey dot).
  7. Now drag that dot slightly to change it's position on the plan layout.
  8. Select the Lower Deck view of the boat and you will see that the Red dot has now become Grey and also moved somewhere to the center of the boat. It happens every time for me.
If you had slightly moved a different dot on the Profile view of the boat that had a different color, then the color of the dot on the lower deck will change to that color. That's the bug.
 

mounty76

Registered User.
Local time
Today, 08:40
Joined
Sep 14, 2017
Messages
341
Yes get the same. This really shouldn't be an issue as there shouldn't be unassigned dots on the plan, only where you grab a new one from, then in that case it assigns a new job. May be a fix would be that no dots can be left unassigned on the plan
 

Mike Krailo

Well-known member
Local time
Today, 11:40
Joined
Mar 28, 2020
Messages
1,044
But it doesn't have to be Unassigned, it could be any other color than the one we created on the Lower deck. Try it with the Black dot instead. Did you see the position of the dot on the lower deck move? That's a real problem. It should never move unless you move it. Something in the code is not accounting for position data on the other deck views other than the one you happen to be on when you move it. Or at least the order in which they are scanned in the code. So if you move an image dot on the lower deck, the code does not affect the position data on any deck views above it, but it does affect the last one you touched below it. That's the bug.

I'm also occasionally seeing "The data has been changed." message. It's something with the way the data in the tables are manipulated in code.

1700232964095.png
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 11:40
Joined
May 21, 2018
Messages
8,529
Try this one. I am sure I broke something else. The issue is that to "link" a dot on the screen with the record it is supposed to represent I use the tag property and put the record ID in the tag. I had code that when you drop an image it got the Max record ID. However that should only happen for a newly dropped image. I did not check this so it changed the tag if you dragged and dropped an existing image and tagged it to the max id. Basically it was changing the properties of the last image you moved. You only saw this when switching screens.
 

Attachments

  • DynamicButtonsV7.accdb
    5.4 MB · Views: 48
Last edited:

Mike Krailo

Well-known member
Local time
Today, 11:40
Joined
Mar 28, 2020
Messages
1,044
This latest version appears to be working. Great job MajP.
 

mounty76

Registered User.
Local time
Today, 08:40
Joined
Sep 14, 2017
Messages
341
This is great, good job MajP. Last two things :) Is it possible instead of deleting a job just marking it as complete with a date stamp, that way we have a history of jobs rather than just deleting it. Lastly is it possible to filter the jobs by department and/or priority with a combo box on the main page? When the filter it applied the dots will only appear according to the filter? Then it would be perfect ;-)
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 11:40
Joined
May 21, 2018
Messages
8,529
Did not do the marking as complete, but that would be easy.
Try the filters.
 

Attachments

  • DynamicButtonsV8.accdb
    5.6 MB · Views: 59

MajP

You've got your good things, and you've got mine.
Local time
Today, 11:40
Joined
May 21, 2018
Messages
8,529
Some updates
1. Records are closed not completed.
2. New records automatically open to edit and require a short name.
3. The selection works much better. You single click on a button and its border turns red. Then you can drag it.
(eventually I will fix it so you do not have to do the single click first. This fix is not trivial and will change how I instantiate the class)
4. The details for the selected record appear at the top of the form

If you can see the purple dot is selected with the red border. Its details appears at the top of the form.

Things to do.
1. Right click to add dots at the current mouse location
2. Looking into being able to change resolution and scale the form
3. Make it so you can drag without first single clicking to select.

Profile Post.png
 

Attachments

  • DynamicButtonsV9.accdb
    5.3 MB · Views: 49

MajP

You've got your good things, and you've got mine.
Local time
Today, 11:40
Joined
May 21, 2018
Messages
8,529
This version incorporates right click features for dropping the image in a specified location and different features if you right click on a button.
I only added a demo of each and did not add other menu items. Could add whatever.
See where the button drops. I had to do Kentucky windage because it would always drop up and left for some reason. Not sure how this will work with a different resolution.
 

Attachments

  • DynamicButtonsV10.accdb
    5.6 MB · Views: 52

Mike Krailo

Well-known member
Local time
Today, 11:40
Joined
Mar 28, 2020
Messages
1,044
Kentucky windage! Well that's down right funny. I like how this project has progressed so far.
 

Users who are viewing this thread

Top Bottom