Normal Topic Drawing Commands (Read 1511 times)
actiontech
Full Member
***
Offline



Posts: 173
Joined: Apr 10th, 2016
Drawing Commands
Mar 6th, 2018 at 2:06pm
Print Post Print Post  
Hello, I can't get any kind of drawing actions to take place. Not sure what I'm doing wrong. The code instructions seem pretty cut and dry, it should just work. I'm thinking that perhaps something is wrong with my application settings again, or it could possibly be a Windows issue. (Windows 7 Ultimate (64-bit))

Here's my code thus far:

Code
Select All
var vName as String
var vFolder as String
var vFile as String

If @Mode() = 0 or @Mode() = 1
{

	vName = Record_ID
	vFolder = "C:\Users\User\Google Drive\AAction Photos\" + vName
	vFile = vFolder + "\" + Pictures_List
	StaticDrawImage(DrawHere, vFile, 100, 100)
	Loiter(1000)
	StaticDrawClear(DrawHere)
}
 

  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: Drawing Commands
Reply #1 - Mar 6th, 2018 at 4:05pm
Print Post Print Post  
You want to be sure that the element you are using as an anchor, in your case DrawHere, is a static text element.

If it is, then your problem is most likely a redraw issue since you are drawing the image, waiting a second and then clearing it. So you will want to call ForceRedraw() when you want the form to redraw. So after you draw the image and then again after you clear it. Normally you would only call it once at the end of your event to show all of the draws that you have done.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
actiontech
Full Member
***
Offline



Posts: 173
Joined: Apr 10th, 2016
Re: Drawing Commands
Reply #2 - Mar 9th, 2018 at 2:31am
Print Post Print Post  
Thanks, works now. Working code:

Code
Select All
var vName as String
var vFolder as String
var vFile as String

If @Mode() = 0 or @Mode() = 1
{
	vName = Record_ID
	vFolder = "C:\Users\User\Google Drive\AAction Photos\" + vName
	vFile = vFolder + "\" + Pictures_List
	StaticDrawImage(DrawHere, vFile, 0, 0)
	ForceRedraw()
}
 



Now, I'm just trying to figure out a way to turn it off without Loiter(). Was thinking to maybe try to load the picture in a popup window as a widget or something. Or if there was a way to, trigger StaticDrawClear(LE) if I clicked anywhere else on the screen or on the Sesame window, or really any other action. Haven't got quite that far yet. I just know that I don't want to use a set amount of time.
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: Drawing Commands
Reply #3 - Mar 12th, 2018 at 3:12pm
Print Post Print Post  
You can create a command button on your form that is a small square with a label of X or "Close Image Preview". Set it to be invisible. and position it where it makes sense. Show it when you draw the image and program it to clear the image and set itself back to be invisible.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
actiontech
Full Member
***
Offline



Posts: 173
Joined: Apr 10th, 2016
Re: Drawing Commands
Reply #4 - Mar 13th, 2018 at 12:56pm
Print Post Print Post  
Ah brilliant. I didn't think about setting it to show visibility when the program is run. That's better than what I was thinking. Thanks.
  
Back to top
 
IP Logged
 
actiontech
Full Member
***
Offline



Posts: 173
Joined: Apr 10th, 2016
Re: Drawing Commands
Reply #5 - Mar 13th, 2018 at 9:58pm
Print Post Print Post  
Ultimately decided to go the route of placing an image box on layer 2 with visibility set to 0 where I want the image to display. The reason for this being that,  I couldn't get the images to center in the middle  of where I wanted them to draw. The landscape pictures looked fine, but the portrait ones were off to the left. Thought about using a PopUp window if it was possible, like to add a widget or something, but it doesn't seem possible at this time. Created an "X" close button in the upper-right corner of that image box on layer 3 and also set it's visibility to 0. I run code and it changes the visibility of both the image box and the close button. Only problem now is that I set that image box to fill so now when I go into Sesame Designer, I have to set it back to bordered every time so I can see the other LE's on layer 1. But it just doesn't look as good if it's not backfilled. Because when it displays on preview it shows the picture in the middle and the rest of where the image box would be is black, just looks cooler that way, in my opinion. Thanks for all the help though, decided to go a simpler route than the draw commands, at least for the time being.
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: Drawing Commands
Reply #6 - Mar 14th, 2018 at 2:28pm
Print Post Print Post  
actiontech wrote on Mar 13th, 2018 at 9:58pm:
Only problem now is that I set that image box to fill so now when I go into Sesame Designer, I have to set it back to bordered every time so I can see the other LE's on layer 1. But it just doesn't look as good if it's not backfilled. Because when it displays on preview it shows the picture in the middle and the rest of where the image box would be is black, just looks cooler that way, in my opinion.


You can use the Attribute() command to change the box style of the image box to be filled in your programming. So you can leave it as framed in Designer and make it filled in Runtime.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
actiontech
Full Member
***
Offline



Posts: 173
Joined: Apr 10th, 2016
Re: Drawing Commands
Reply #7 - Mar 15th, 2018 at 3:05am
Print Post Print Post  
Thanks, works great. Working code:

View_Picture :: On Element Entry

Code
Select All
#include "sbasic_include.sbas"

var vName as String
var vUser as String
var vFolder as String
var vFile as String

If @Mode() = 0 or @Mode() = 1
{
	vName = Record_ID
	vUser = @GetLocalEnvVar("USERPROFILE")
	vFolder = vUser + "\Google Drive\AAction Photos\" + vName
	vFile = vFolder + "\" + Pictures_List
	View_Picture_Box = vFile
	Attribute(View_Picture_Box, ATTR_ID_BOX_TYPE, "14")
	ForceRedraw()
	Visibility(View_Picture_Box, 1)
	Visibility(Close_Picture, 1)
	Visibility(Send_Customer_Request_To_History, 0)
}
 

  
Back to top
 
IP Logged