Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Display images in List (WCD and Working Preview Mode)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Display images in List (WCD and Working Preview Mode)

    Is it possible to display images in a List control of a UX component in the working preview or WCD mode? I'm filling the list with filenames based on a custom Xbasic function and setting the field type to raw. In the List field layout I've created a freeform layout and placed the <filename> tag inside an <img src={filename}> tag which works when I run under Live Preview or via WAS but not in WCD. I've modified the code in my Xbasic function to fill the list with relative path names when running under WAS or in Live Preview but with an absolute file path when running under WCD and working preview so my paths look like:

    photos\photoname1.jpg under WAS and
    C:\Users\Brad\Documents\Photos\photoname.jpg when in WCD or Working Preview.

    Any thoughts?
    Brad Weaver, President
    ComputerAid International
    Ottawa ON Canada
    Versailles KY USA
    www.compuaid.com

    #2
    Re: Display images in List (WCD and Working Preview Mode)

    Okay, here's how I got around this. Assuming you're using Windows 7 or later you can create a symbolic link to the photos directory under your A5webroot as well as your A5webroot\projectname and A5webroot\LivePreview directories. This way no matter where you're running the component you'll have access to the photos directory under the current root. Now when using a WCD you can refer to the physical path of the symbolic link directory under A5Webroot\projectname i.e. C:\A5Webroot\PVA\photos and you'll be displaying photos from the correct location. To change the physical location you just do a RMDIR photos and then recreate the link. To refer to the same location running under WAS or LivePreview just use the relative path Photos\filename.jpg.

    IMPORTANT!!!! When creating the symbolic link always use the /D to make it a directory. Ex: mklink photos C:\Users\Documents\Myphotos /D

    DOUBLY IMPORTANT!!!! If you decide to remove the link DO NOT simply delete it or you will actually delete all your photos. Instead from the command prompt use the RMDIR command i.e. RMDIR PHOTOS. This will delete the symbolic link but leave your photos in tact in their original directory.

    Here's another cool thing about symbolic links - they can refer to UNC shares on other systems so the Photos directory could actually be linked as:

    mklink photos \\OTHERCOMPUTER\SHARENAME\Photos /D
    Brad Weaver, President
    ComputerAid International
    Ottawa ON Canada
    Versailles KY USA
    www.compuaid.com

    Comment


      #3
      Re: Display images in List (WCD and Working Preview Mode)

      *THIS ONLY WORKS FOR ALPHA ANYWHERE BUILD 1548 OR LATER due to a bug that was discovered and fixed with Lists based on a single field. If you have an earlier version there is a work around or you can request the latest Pre-Release build from Alpha.

      Okay, here's how to display photos in a list control from a directory regardless of the environment the UX component is running under. This will allow you to display photos using the equivalent of Image File Reference fields without having to actually store the filenames in a table. It looks up the filenames from the directory and then depending on whether your component is being run using WAS, LivePreview or as a WCD running on the desktop, populates the list control with the correct path and file names. This assumes you have a table called Settings that has a field called Photo_Directory that contains the physical path to your photos. I've found that it is best to use the method described in the previous post to setup a symbolic link under your A5WEBROOT\project directory and then refer to that directory in your Settings table to be sure that your application has permission to see the photos. Also, in your AutoExec using Xbasic DIM a global variable called InDesktop and set it to .T. We'll check for its existence in the Xbasic function to determine whether we are running in Desktop mode or using the WAS environment.

      First, add your list control then under List Properties on the Data Source tab set the source to Custom.

      Check the Define Xbasic in Control under the Advanced section and then add the following function by clicking on the ... next to the Xbasic code:

      Code:
      function getphotos as c (e as p)
      	DIM files AS c ' Used to store the filenames in our directory
      	Dim newfiles as c ' Used to prepend the correct physical or relative path
      	Dim photodirectory as c ' Used to store the physical location of our photos directory
      
      	'Retrieve the directory where the photos are located from the SQL Settings table
      	'This assumes that a table is setup on the SQL server called Settings that has
      	'a field called Photos_Directory and that a named AlphaDAO connection call ARPRO_SQL
      	'points to this database.
      	photodirectory = sql_lookup("::NAME::ARPRO_SQL","Settings","UID=1","Photos_Directory")
      
      	' Test for runtime environment and use the data submitted if available
      	' The following code is inserted only so that a default value will provide
      	' a list of files to the list builder in design time.  By checking for the
      	' e.datasubmitted collection we can determine if this function was called
      	' during runtime or by the Alpha List Builder design component.
      	if eval_valid("e.datasubmitted.map_no") then
      		'Runtime mode so use the actual map n
      		if len(alltrim(e.datasubmitted.map_no))>0 then
      			'Set our filename search to the map_no field and append an *
      			'so we can retrieve all photos in the sequence that start
      			'with the specified map_no.
      			curmap = alltrim(e.datasubmitted.map_no)+"*.jpg"
      		else 
      			curmap = "Nomapfound" ' Set to a bogus filename to return nothing and clear the list 		
      		end if
      	else
      	' Otherwise use a valid default filename sequence to use with the the list builder designer
      		curmap = "001-40-00*.jpg"
      	end if
      	
      	' Retrieve list of matching files from our directory assigned above
      	' Only the filenames are retrieved.  No path as we'll add the appropriate path
      	' below depending on our runtime environment
      	files = filefind.get(PhotoDirectory+curmap,FILE_FIND_NORMAL,"N")
      
      
      	' Now determine whether to use the full file path or the relative web
      	' path based on whether we're running on a WAS server or as a WCD component
      
      	if eval_valid("IsDesktop") then ' Check to see if global variable exists (only in desktop)
      		' Running in WCD so prepend complete physical file path
      		' In order to work with a shared directory setup a symbolic linked directory
      		' under the A5webroot\projectname directory:
      		'      mklink photos \\servername\sharename /D
      		' Then reference that directory in the Settings table
      		newfiles = *for_each(currfile, photodirectory + currfile,files)
      	else
      		'Running on WAS server or in live preview so prepend relative path
      		newfiles = *for_each(currFile, "photos\\"+currFile,files)
      	end if
      
      	' Assign our list including a field header Filenames of type C to our function return value
      	getphotos = "Filenames=C"+crlf()+newfiles
      end function
      In the list component Click on the Fields tab set the Filename control type to RAW DATA. Now click on the List Layout tab and add the following to the Template:

      <img src="{filenames}" height="200px"> (Of course you can modify the attributes such as height, width, etc to your liking)

      Save your list and you should now see your photos.
      Last edited by compuaid; 07-17-2013, 10:46 AM. Reason: Post info regarding required Alpha release
      Brad Weaver, President
      ComputerAid International
      Ottawa ON Canada
      Versailles KY USA
      www.compuaid.com

      Comment

      Working...
      X