Programmatically move a control on a view (1 Viewer)

ZacWolf

New member
Local time
Yesterday, 19:25
Joined
Mar 6, 2017
Messages
5
Is it possible via macro to move the position (or resize) a control (textbox, label, etc) dynamically/programmatically?
 

sneuberg

AWF VIP
Local time
Yesterday, 16:25
Joined
Oct 17, 2014
Messages
3,506
That fairly easy to do in VBA but I don't see any way of doing it in a macro. I suggest learning VBA. This video series would give you a good start.
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 16:25
Joined
Aug 30, 2003
Messages
36,124
I suggest learning VBA.

I'd agree, but won't help in this situation; no VBA in web apps.

I think SetProperty exposes those properties, but no idea if it works in a web app.
 

sneuberg

AWF VIP
Local time
Yesterday, 16:25
Joined
Oct 17, 2014
Messages
3,506
Sorry I didn't notice this was in the Web Access forum. Also apparently I'm wrong. You can manipulate these properties via SetProperty. In the attached database there is a form with two simple examples. One button modifies the Height and Width property of a rectangle and the other modifies the Left property. Note that the values in the macro are in twips.
 

Attachments

  • MoveAndResizeWithMacro.accdb
    352 KB · Views: 176

ZacWolf

New member
Local time
Yesterday, 19:25
Joined
Mar 6, 2017
Messages
5
I think SetProperty exposes those properties, but no idea if it works in a web app.

SetPropery in webapp macros expose only the following in the attached screen grab.
 

Attachments

  • Capture.PNG
    Capture.PNG
    2.7 KB · Views: 160

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 16:25
Joined
Aug 30, 2003
Messages
36,124
That's what I was afraid of.
 

sneuberg

AWF VIP
Local time
Yesterday, 16:25
Joined
Oct 17, 2014
Messages
3,506
Wow not only are you limited to macros but the macro's access to properties are limited on top of that. I think I'd get frustrated real fast working in an environment like that.

Thanks for the feedback on this.
 

ZacWolf

New member
Local time
Yesterday, 19:25
Joined
Mar 6, 2017
Messages
5
Yeah, I've been able to work around a great deal of the frustration, but after six years one would think that the feature-set for webapps would have grown more than it has.
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 16:25
Joined
Aug 30, 2003
Messages
36,124
I think there are security and performance trade-offs to make apps work in a web-based environment. Maybe that kind of dynamic movement of the controls can't be done in a browser? Who knows, I'm only speculating. I was paying more attention when they first came out, as I was excited to try them. Didn't need them enough to fight through the learning curve. I know those trade-offs are why VBA can't be used.
 

sneuberg

AWF VIP
Local time
Yesterday, 16:25
Joined
Oct 17, 2014
Messages
3,506
Maybe that kind of dynamic movement of the controls can't be done in a browser?
This web page seems to imply that they can but I'm pretty sure that the macro code needs to be translated into something that would run in a browser like Java or Javascript at some point. My guess is that Microsoft just doesn't want to spend the bucks to implement it.
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 16:25
Joined
Aug 30, 2003
Messages
36,124
If memory serves, macros are converted to Javascript to run in a browser. I know the Access development team is constrained in what they can work on, so maybe they haven't been able to devote resources to this particular need. They have to balance the demands of management, customers via UserVoice and such, and MVP's whispering in their ears.
 

ZacWolf

New member
Local time
Yesterday, 19:25
Joined
Mar 6, 2017
Messages
5
Well I spent six hours going down a rabbit hole to figure out a work around. I thought maybe I could use their "web box" display item to load some Javascript to manipulate the page, but that lead to issues with crossdomain blocks, so in trying to figure out how to host an html file on the Sharepoint server, even after created a new content-type that should identify an .html file as text/html, instead it keeps sending as binary so that instead of viewing it triggers a download.

Via a "real" SharePoint server it would be possible to set both "true" mime-types, or set the "BrowserFileHandling" property to passive; but after loading up all the necessary PowerShell addons to connect to a web based SharePoint server, they've even made this property "read only" for the 365 version of SharePoint.
 

Users who are viewing this thread

Top Bottom