Menu
  • HOME
  • TAGS

How do you move an object in LiveCode by a given amount of pixels?

livecode

There are a variety of methods you can employ depending on how smooth you want the animation to be. At the simplest level you need to move the objects in script by setting their position related properties: top, left, right, bottom, loc and rect. set the top of button 1...

Get Unicode Text from SQLite DB

sqlite,unicode,livecode

put textDecode(MyVariable,”UTF8”) into NewVariable ...

How to count occurance in livecode?

livecode

Try using offsets, which should be faster than examining every word: put fld "MytextField" into tText set the itemdel to colon repeat for each element e in myArrayL put item 1 of e into searchStr put 0 into tSkip repeat get wordOffset(searchStr,tText,tSkip) if it = 0 then exit repeat add...

How to colour a specific word in datagrid

livecode

locate the word and use its position with chars similar to this set the backgroundColor of char 20 to 22 of fld 1 to orange or since it is a datagrid: set the htmltext of field 1 of group "datagrid 1" to "<font bgcolor="&quote&"#FF0000"&quote&">test text"...

Prevent SQL Injection in Livecode

sql-injection,livecode

LiveCode does sanitisation and uses parameters in queries as described here. So, if you are building your query like this, LiveCode is not helping, and you do need to escape your own query: get revDataFromQuery(tab, return, gConnectionID, "SELECT * FROM users WHERE email LIKE '%" & theSearchString & "%'") However,...

Repeat in array with subselection

arrays,livecode

Not the way you have written it. If you are in array mode, you must stay in array mode. If in the clear, stay in the clear. You have a mixed bag. I would do this fully in the clear. After deconstructing the array variable with the "combine" command, and...

Moving editable items between two separate lists?

list,livecode

With all the code here, it's difficult to tell what you're trying to accomplish, and there doesn't appear to be any picture to reference. It's not clear what constitutes an "item": A title? A description? A line of text? Generally, an "item" refers to a comma-delimited element of a line...

How to get picture current frames from video file in Livecode?

video-capture,snapshot,livecode

One way to achieve this would be to assign the video to a player object, set the visible of the players controller to false and then use the following script- import snapshot from player "name of your player" What this does is take a snapshot of the current frame of...

Creating a handler to increase font size

text,livecode

Change your handler to use the selectedChunk instead of the selectedText. on txtSizeUp set the textSize of the selectedChunk to the textSize of the selectedChunk + 1 end txtSizeUp And for good measure, of course: on txtSizeDown set the textSize of the selectedChunk to the textSize of the selectedChunk -...

Livecode Responsive UI Android App

android,user-interface,responsive-design,livecode

Let's assume that you have a card with one field and one button. When you open the stack, you can set the rect of the stack to the screenRect. This triggers the resizeStack message, which lets you rearrange the controls on the card. on preOpenCard set the rect of this...

answer file dialog not recognizing cancel

livecode

Just replace "the result" with "it" and it should work. The user response of an answer dialog is stored in the variable "it". Btw, pressing "cancel" in an "answer file" dialog does return nothing to the variable "it" So you could change your script like this answer file "Bitte Bild...

Livecode standalone program takes 30 seconds to load

windows,performance,batch-file,cmd,livecode

If you call the program from the prompt directly, e.g. using C:\program files (x86)\your_standalone.exe the app is treated as a command line app. I have also noticed that a LiveCode app can sometimes close if the invoking command line prompt is closed, while it may sometimes continue to run. Perhaps...

How to set rect on using a native video player when set fullscreenmode to “exactFit” in Livecode?

android,ios,iphone,video,livecode

Maybe this is what you're after... mobileControlSet pID, "rect" , the rect of img "poster" on second thoughts - it looks like that's already in your code - maybe try... set the lockLoc of img "poster" to true it could be getting resized to the images original dimensions at some...

Livecode: Sort an Array and Display It

arrays,sorting,livecode

How about: sort lines of it numeric descending by tNum[each] By the way "num" is reserved in LiveCode as a short for number so you need to change num[1] etc to something else to get your code working....

How hide multiple lines using Livecode

livecode

Check out the 'wordsToSkip' parameter of wordOffset in the LC dictionary. If you don't manage this and have several sets of equation text to find then your code will always find, and stop at, the first match it finds. You have two ways you could handle multiple instances of equation...

How to hide menu bar in second card in livecode

livecode

The menubar is a group, which by default is created with its backgroundBehavior property enabled, and is probably added to all cards. To remove the menubar from a card, select the menubar group, use the Inspector to disable the group's backgroundBehavior, and then choose Remove Group from the Object menu....

How do I change the icon of a button in livecode, using code and not the inspector tool?

button,live,livecode

set the icon of button "abc" to 1044 or set the icon of button "abc" to the id of image "source image" In both cases you are setting the icon property of the button to the id of an image object....

Can LiveCode recognise the characters that I draw?

android,gesture-recognition,livecode

I did some basic character recognition for my 'Spell With Kyle' app. It currently only recognises one character at a time, but the idea could be worked on if you need something more complex. There's an explanation of the technique and an example stack at http://splash21.com/Gestures.html HTH :D (It's just...

UI from Livecode is not the Same as on Android

android,user-interface,text,livecode

If you're not including a font in your APK file, chances are that Android chooses a font different from the font chosen by iOS. Either set the textFont of the field to a font that is available on both platforms or include your own font. If you include a font...

MergJSON LiveCode External for iOS standalone setup

ios,json,livecode

You only need to include the lcext file in the copy files section of standalone settings. No need to setup a runtime folder for iOS etc.

Is it possible to have a command last only while the object is moving?

object,livecode,motion

The answer to this depends on how you move the object. If you use the built-in move command to move an object, the movingControls function will return a list all objects that are in motion. If you use your own repeat loop to move an object, you'll need to continually...

How to get a word under cursor in Livecode

livecode

Try "the mouseChunk" function. In the field script: on mousemove put the value of the mouseChunk end mousemove Should be just the ticket. Craig Newman...

Searching word in a text file

livecode

Try to avoid the repeat with syntax as much as possible. Instead, use the repeat for eachsyntax: put 0 into myLineNr repeat for each line myLine in myData // update counter add 1 to myLineNr if myLine contains mySearchString then // store data in new variable put line myLineNr -...

how to refresh the favorites selection automatically in data grid

livecode

I've got it working OK, thanks to TerryL on LC Forum Created another command, deleteFavorites which is identical with refreshFavorites except the 1 line: answer "Sorry, but you must select at least..." and that new command I have put in the Row Behavior of the data grid: on mouseUp pMouseBtnNum...

Escape HTML text

html,file-io,livecode

Often, people use functions like function q theText replace "'" with quote in theText return theText end q which can be used as write q("<div id=hidden-'" & myKanton & "' style='display:block;'" & "class='popuptable'>" & LF) to file tOutputFileCH You can use a string like in above example but you can...

Data Grid with native Android scroller gets stuck or does not show the whole list

livecode

OK, I figured it out. I added this line: send "delete_scroller" to cd "main" in 0 sec in each handler (at the beginning of it) that creates new view in the data grid and this one: send "create_scroller" to cd "main" in 0 sec in the same handler at the...

Get a Value from One Cell in Sqlite to Livecode

sqlite,return-value,livecode

You can use any of LiveCodes database functions. First you need to open the database via: revOpenDatabase("sqlite",filepath[,sqliteOptions]) Then you can query the database via one of the query commands: revQueryDatabase(databaseID,SQLQuery[,{variablesList | arrayName}]) There is also a function called revDataFromQuery([columnDelim],[rowDelim],databaseID,SQLQuery[,varsList]) that you might use for your query. Look them up in...

How to play videoClip by Quicktime player in Livecode?

livecode

Link to the video file in the standalone application settings: Open the standalone application page from the file menu Go to the copy files tab Add your video file or a folder containing your video file Build your standalone The standalone will be build with the video file in your...

How to create player and set autoplay with code at runtime?

livecode

You just need to start the player after copying it. set the filename of player "Player" of card "object" to "myurl" copy player "Player" of card "object" to stack "stack2" put the number of players of card "object" of stack "stack2" into myNumberOfPlayers start player myNumberOfPlayers of card "object" of...

How do you find the sum of all the numbers in an array in Livecode?

livecode

The "sum" command is what you need. Check out the dictionary; arrays are supported, though the function is generally used with a comma delimited list. You can also extract the keys of the array, if they are purely numeric, and apply the function. Otherwise, you may have to extract the...

Log in page does not work properly

livecode

You haven't mentioned what the exact problem is -- are you getting an error somewhere? One issue might be mismatched variables: you have global Username and script variable sUserName. Also, is this all your code? If yes, you're not calling the loginCheck handler anywhere, so no comparison is taking place....

Controller of player doesn't show after touch done by using a native video player in Livecode

ios,video,fullscreen,livecode

I see the question is tagged as ios, so this might work ... on playerLeaveFullscreen mobileControlSet pID,"showController" , true end playerLeaveFullscreen (you may have to declare pId to make it available!)...

Does the mergMK module for LiveCode require an internet connection to function?

livecode

mergMK is just Apple Maps/MapKit so it will behave the same way as the Apple Maps app while offline. In a quick test I did it appears to render maps that are already cached and show a blank areas elsewhere.

How to find out the rarkey value for delete key

livecode

If you capture the rawKey value in a rawKeyDown handler, you must pass the message if you want any of the key presses to be handled by the engine. This is the case with any of the key messages you want to handle (e.g., rawKeyUp, keyDown, keyUp); if you do...

Livecode: Detect cursor position inside the field

livecode

Use the selectionChanged message to detect changes in the cursor position. Use openField to find out when the user clicks in an unlocked field. The selectedChunk tells you exactly where the cursor is. If no text is selected, the first number in the selectedChunk is higher than the last number....

Detect if the Button is Enabled or Disabled in Livecode

button,detect,livecode

First of all, I notice that you start all your script lines with capitals. I'd recommend starting your lines with lower case characters. That will give you more flexibility with regard to camel-caps syntax that is so typical of LiveCode scripts. You can't compare a control to a constant. A...

How to get list card of stack ? - livecode

livecode

Here's an example that creates an array with the stack card names as keys. Each array element contains a list of the controls for the card. on mouseUp local tCurrentStack, tCards, tCurrentCard, tControlsA put "MyStack" into tCurrentStack put the cardNames of stack tCurrentStack into tCards repeat with tCardIndex = 1...

SELECT * FROM giving other result then SELECT 2010,2011 FROM

php,mysql,datagrid,livecode

This part of your code SELECT 2010,2011 From the manual http://dev.mysql.com/doc/refman/5.1/en/identifiers.html "Identifiers may begin with a digit but unless quoted may not consist solely of digits." wrap those column names in ticks. SELECT `2010`,`2011` Since you didn't post your error message. Sidenote: Copy/paste it from this answer. Ticks and regular...

How to create a custom dialog box in LiveCode

livecode

The simplest example of a dialog box is this. Make a new substack of your mainstack and call the substack "Dialog". Add a button to the substack, call the button "OK" and give it the following script: on mouseUp set the dialogData to "OK" close this stack end mouseUp Make...

How to create a folder and sub folder

livecode

create folder pathName should work fine

Place Text to Many Label Fields Using Loops and Arrays in Livecode

arrays,loops,livecode

Try this: repeat with i = 1 to 10 set text of field ("label" & i) to "Me" end repeat ...

Pass Variable and Value from One Card to Another Card Livecode

livecode

I think you should be able to do put cd fld "textField" into cd fld "otherField" of card "Card2" to do that. If that doesn't work, you can instead do put cd fld "textField" into theFieldText go to card "Card2" put theFieldText into cd fld "OtherField" or alternately, you could...

Livecode Datagrid Copy and Paste

livecode

Yes, if cell editing is enabled, you will find that a DataGrid acts very much like a spreadsheet. Just pretend you are in Excel, and use the DataGrid the same way. So if you copy some portion of data in a "cell", you may set the insertion point at any...

How to delete Line in the datagrid?

livecode

Daatgrids have more properties than normal controls, see: http://livecode.wikia.com/wiki/Datagrid_API I suggest you to use the dgText property, like the following code: put the dgText of group "DFP" into temp delete line 1 to 2 of temp set the dgText of group "DFP" to temp ...

How to search hyphenated words

livecode

Please use this code if myWord contains the words of myData then instead of if myWord is among the words of myData then ...

Problems in substack

livecode

You need to tell where the field is: on mouseUp find "Work" in field "text" on stack "mainstack" -- your stack's name, or use stack id XXXX end mouseUp ...

How i write file into home(In linux system)

livecode

As your last1 variable is enclosed in quotes, it's getting treated as a literal string rather than a variable. The following would work: put field "bash1" into URL ("file:" & last1 & "/dic.sh") Note that you do not have to refer explicitly to the text property when putting texts from...

How i copy the content of selected row

livecode

Set the global clipboarddata property to set the clipboard: on mouseUp put the dgHilitedLines of group "data" into myLine set the clipboarddata["text"] to line myLine of the dgText \ of grp "data" end mouseUp ...

My LiveCode stack size is too large for my display. Is there away to adjust it so that it fits on my screen?

livecode

As of the latest stable release, 6.6.1, there is a scaleFactor property that you can use to scale the visual size of the stack to a percentage of its actual size. set the scaleFactor of stack "hugeStack" to .75 ...

How to refresh item in a popup menu in Livecode

livecode

First create a pop-up menu and give it a name, e.g. "List A". Now create a control with a mouseDown handler or add a mouseDown handler to the card script. on mouseDown theMouseButton if theMouseButton is 3 then put "One item,Another item,A third item,The last item" into myList replace comma...

Can't play video from url - Livecode

livecode

The correct syntax for that is set the filename of player "Player" to "http://elanorb.on-rev.com/lessons/MalteBrill.mp4" Marks example contains the keyword URL before the url. But this will not work. At least here in LC 6.6x....

How to adding and append code on runtime ? - livecode

livecode

Here's an example. Best to save your stack before testing! on mouseUp local tScript, tLine put the script of card "MyCard" into tScript put lineOffset("end opencard", tScript) into tLine if tLine > 0 then put format("put \"test\" into TestV") & LF before line tLine of tScript set the script of...

Generate Unique Random Numbers in Livecode

random,unique,livecode

Here's one way: put "1,2,3,4,5" into theList sort items of theList by random(10000) repeat with N = 1 to 5 set label of button ("button" & N) to item N of theList end repeat ...

How to replace a string in the first occurrence

livecode

Use the wordOffset function: on mouseUp set the wholeMatches to true -- OPTIONAL put wordOffset("Malayalam",field "text") into N if N <> 0 then put "English" into word N of field "text" end mouseUp The optional line will cause replacement to occur only for an exact match of the source word....

How do you use a range of numbers in an if statement in livecode?

numbers,range,livecode

It looks like you're trying to determine whether an object's location (its center point) falls within a rectangular area. Try using the is within operator: if the loc of image "yellowdisk.png" is within the rect of graphic "targetRect" then # do true stuff else # do false stuff end if...

Moving editable items between two lists?

list,livecode

It isn't clear to me why you save that much data in properties. Once data is in a field, you can just keep it there. When you need to move data from a field on one card to a field in another card, you can do so directly. For example,...

Get the Highest Value in Livecode

max,livecode,highest

This is quite standard in any programming language. put max(var1,var2,var3) into myMax ...

Compiled iOS app automatically opens keyboard on start

livecode

Apparently, when the card opens, there is a field that gets focus. Perhaps you think a field is locked but it isn't. It can also be a combobox or datagrid that gets focus. Probably, the best way to test this is to run the following script before compiling your app:...

Return an Array Length in Livecode

arrays,livecode,variable-length-array

you can try: "item 2 of the extents of YourArrayName" will show you the last element number, which is in some cases the length of an array. item 1 will shoe you the first element number. Elements are sometimes also called indexes. MyArray[1],MyArray[2] etc. or put the number of elements...

How to Find a word with spaces in livecode

livecode

In LiveCode, the space character delimits words -- a single word doesn't contain spaces. If there's only one instance of the string of characters you're searching for, you could use the offset function: put "X1 X2 X3" into theString put the text of fld "f4" into temp put offset(theString,temp) into...

How to upload file to a server with php - Livecode

livecode

I do not know, if your php code is correct, but your livecode part isn´t. To post files to a webserver you need the libUrlMultipartFormData function. Below you find a sample from the libURL documentatin. I adjusted it a little bit using your values put empty into tFormData put "http://www.someserver.com/cgi-bin/form.cgi"...

Is it possible to have a user draw a graphic in livecode?

livecode,graphic

Check out the choose command. This should get you started. To start out drawing your line: (This could be in a a button script, for example. However you want to trigger the user drawing.) if there is a graphic "userLine" then delete graphic "userLine" end if set the style of...

Login form have some problems

livecode

One simple method is to use the keyDown message along with a custom property to store the clear text. Place the following code in the password field's script: on keyDown theKey -- RESTRICT THE ALLOWED KEYS TO SOME DEFINED CHARACTERS if theKey is not in "abcdefghijklmnopqrstuvwxyz1234567890" then exit keyDown put...

How to Run the Card Script Without Switching to that Card in Livecode?

startup,livecode

You could move the code from the openCard handler to a different handler, e.g. initializeCardand call that handler from both the openCard and the openStack handlers. However, if a card executes a script and refers to objects on that card, you may get the object not found handler. Therefore, you...

How to count the sum of numbers in a field in Livecode

livecode

on mouseUp if the field "CC" is not empty then//here "CC" is an Scrolling field and it's containing the content put 0 into aa put fld "CC" into myData split myData by CR put the number of lines of (the keys of myData) into myArraylength repeat with i = 1...

Create a new color from two RGB values

rgb,livecode

It isn't exactly clear how you want to combine the colours. If you want to blend the colours, you might simply add them. put 255,0,0 into myRed put 0,0,255 into myBlue put 0,10,100 into myGreen repeat with x = 1 to 3 put min(item x of myRed + item x...

How to select a word with special characters in LIvecode

livecode

If you don't have a huge text in your field you might use: on mouseMove if the mouseLoc is within the rect of me then put the mouseChunk into tChunk # Check if chars before or after is a "spacing char" put word 2 of tChunk into tstart put word...

How to get data from grid

grid,livecode

put the dgHilitedLines of group "Datagrid" into mylist put the dgText of group "Datagrid" into myText repeat for each item tItem in mylist put line tItem of myText & CR after myselctedlines end repeat answer myselctedlines see http://livecode.wikia.com/wiki/Datagrid_API...

How to delete a row in datagrid

livecode

Did you try using the index instead of the line? put the dgHilitedIndex of me into theIndex DeleteIndex theIndex The line is always the current display order, say A = 1 B = 2 C = 3 Thus if you delete line 2, the next line C will become line...

How to create button to another stack - Livecode

livecode

Here's one way to do what you want: on createDigits set the defaultStack to "BB" create button "test" end createDigits ...