Aligning Bananas and Numbers in a single (Text) field - doable ?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

liveme
Posts: 240
Joined: Thu Aug 27, 2015 5:22 pm
Location: down under

Aligning Bananas and Numbers in a single (Text) field - doable ?

Post by liveme » Fri Apr 16, 2021 12:10 am

Hi ppl,

I saw some similar vues in a datagrid...somewhere :

Next, I need to display very few "elements" (<10 characters/icons) within a single field :

All Elements, Icons or Numbers... are predifined on a small keyboard
Pressing Keys down "Would" fill the Target field with Numbers and "Icon image" until all spaces are filled up.

The keyboard is almost ready...what I need to know is how to align the combination of click results of bananas and digits:
8)
- should I go for a text field or for a "rectangle frame" with X (empty) aligned cells inside to fulfill after each clicks?

It would display something like :

Code: Select all

1 "Banana Icon" + 2 "Apple Icon" = "Plate Icon" 


- literaly the target field should be able to display :
a number ...an icon ...another number ...another icon..Etc...
...icons in place of words

What "possible" field/component type is most likely indicated to achieve that ?

*Food algorithm not required ! :mrgreen:
Tks Scrunch Miomm :)

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 875
Joined: Wed Nov 22, 2006 3:42 pm

Re: Aligning Bananas and Numbers in a single (Text) field - doable ?

Post by Thierry » Fri Apr 16, 2021 3:57 am

Hi liveme,

Sorry, no bananas here but may be you could do something with this?

Here is a standard LC field:

screenshot 2021-04-16 à 04.52.55.jpg
screenshot 2021-04-16 à 04.52.55.jpg (8.88 KiB) Viewed 8418 times

and the script of the field:

Code: Select all

on mouseUp b
   if b = 3 then
      put "android: 1  apple:  2    iOS:  3" into me

      set the imageSource of char oC("1") of me to \
            ("binfile:" & pictFolder & "icons8-android-48.png")

      set the imageSource of char oC("2") of me to \
            ("binfile:" & pictFolder & "icons8-apple-logo-50.png")

      set the imageSource of char oC("3") of me to \
            ("binfile:" & pictFolder & "icons8-ios-logo-50.png")

   else
      put empty into me
   end if
end mouseUp

function oC C
   return byteOffset( C, me)
end oC

HTH,

Thierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!

liveme
Posts: 240
Joined: Thu Aug 27, 2015 5:22 pm
Location: down under

Re: Aligning Bananas and Numbers in a single (Text) field - doable ?

Post by liveme » Fri Apr 16, 2021 5:51 am

yeah..;no bananas, this is a must feature for the next release !
How could livecode live without it :shock:
Ok, so just a simple field..cool,
Tks for the code, testing that next....
...*Long live to Coconuts then :lol:

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 875
Joined: Wed Nov 22, 2006 3:42 pm

Re: Aligning Bananas and Numbers in a single (Text) field - doable ?

Post by Thierry » Fri Apr 16, 2021 9:13 am

liveme wrote:
Fri Apr 16, 2021 5:51 am
yeah..;no bananas, this is a must feature for the next release !
How could livecode live without it :shock:
Of course they have one, but deeply hidden in the resources.
New widget called "banana-split-pops" made by the Great bogs



banana split pops.jpg

Ok, so just a simple field..cool,
Tks for the code, testing that next....
Please, check the dictionary for imageSource, you have few options.

Happy coding Image Image

Thierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Aligning Bananas and Numbers in a single (Text) field - doable ?

Post by bogs » Fri Apr 16, 2021 12:08 pm

Thierry wrote:
Fri Apr 16, 2021 9:13 am
liveme wrote:
Fri Apr 16, 2021 5:51 am
yeah..;no bananas, this is a must feature for the next release !
How could livecode live without it :shock:
Of course they have one, but deeply hidden in the resources.
New widget called "banana-split-pops" made by the Great bogs
Thierry knows the 'Great and powerful Bogs' loves the only bannana you'll ever need hee hee.... Image
Image

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 875
Joined: Wed Nov 22, 2006 3:42 pm

Re: Aligning Bananas and Numbers in a single (Text) field - doable ?

Post by Thierry » Fri Apr 16, 2021 1:30 pm

bogs wrote:
Fri Apr 16, 2021 12:08 pm
Thierry knows the 'Great and powerful Bogs' loves the only bannana you'll ever need hee hee....
Image

Well, then you might be able to help me with this crazy thing?

Can't manage to make this command works:

Code: Select all

   open datagram socket to bananaSocket  with message "bananaSent"
and no errors thrown and the result is empty.
but this one works:

Code: Select all

   open datagram socket to bananaSocket
   send "bananaSent" to me in 0
I prefer the first method :(

any idea ? is it a known bug ?

Thierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9359
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Aligning Bananas and Numbers in a single (Text) field - doable ?

Post by richmond62 » Fri Apr 16, 2021 2:26 pm

SShot 2021-04-16 at 16.23.40.png
-
This stack uses the LEFT, RIGHT and DOWN arrow keys:
-

Code: Select all

on rawKeyUp RP
   switch RP
      case 65361
         put "•" after fld "fff"
         set the imageSource of the last char in fld "fff" to the id of img "bb"
         break
      case 65364
         put "•" after fld "fff"
         set the imageSource of the last char in fld "fff" to the id of img "aa"
         break
      case 65363
         put "•" after fld "fff"
         set the imageSource of the last char in fld "fff" to the id of img "pp"
         break
      default
         --put numToCodePoint(RP) after fld "fff"
   end switch
end rawKeyUp
Attachments
FRUITY.livecode.zip
Here's the stack.
(10.97 KiB) Downloaded 122 times

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Aligning Bananas and Numbers in a single (Text) field - doable ?

Post by bogs » Fri Apr 16, 2021 10:57 pm

Thierry wrote:
Fri Apr 16, 2021 1:30 pm
bogs wrote:
Fri Apr 16, 2021 12:08 pm
Thierry knows the 'Great and powerful Bogs' loves the only bannana you'll ever need hee hee....
Image
Well, then you might be able to help me with this crazy thing?

Can't manage to make this command works:

Code: Select all

   open datagram socket to bananaSocket  with message "bananaSent"
and no errors thrown and the result is empty.
but this one works:

Code: Select all

   open datagram socket to bananaSocket
   send "bananaSent" to me in 0
I prefer the first method :(

any idea ? is it a known bug ?

Thierry
As much as I hate to say it, I never did get around to using sockets yet, and it is likely at this point I may not ever have the time to get around too them :oops:
Image

liveme
Posts: 240
Joined: Thu Aug 27, 2015 5:22 pm
Location: down under

Re: Aligning Bananas and Numbers in a single (Text) field - doable ?

Post by liveme » Sat Apr 17, 2021 2:22 am

waow...someone had already made a similar banana/apple formula !!!
Weird...LC saving my day....n the planet !
:wink:

Thanks for this Stack !!

liveme
Posts: 240
Joined: Thu Aug 27, 2015 5:22 pm
Location: down under

Re: Aligning Bananas and Numbers in a single (Text) field - doable ?

Post by liveme » Sat Apr 17, 2021 2:36 am

Really cool, I like that the stack holds the Icons themselves... no external images storage !
:idea:

liveme
Posts: 240
Joined: Thu Aug 27, 2015 5:22 pm
Location: down under

Re: Aligning Bananas and Numbers in a single (Text) field - doable ?

Post by liveme » Sat Apr 17, 2021 5:14 am

BTW Thierry... you seem to know how to setup a socket connection...

I'm using this to connect to my DB.
put revOpenDatabase("mysql", tDBurl, tDBname, tDBuser, tDBpword) into gConID ## tResult
..not sure how its even named

What would it takes to set up a socket to a MariaDB DB. (websocket?) connection to retreive data...?

Would you know what are the Pro/Cons using socket vs my actual (?) connection type ?

I've never used socket before...can they be restricted to only "preregistred member users"...or are they meant only for public access to someone's DB...
:?: :!: :!:
to banana ..or not to banana ! :mrgreen:

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9359
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Aligning Bananas and Numbers in a single (Text) field - doable ?

Post by richmond62 » Sat Apr 17, 2021 7:04 am

someone had already made a similar banana/apple formula
Nope: I made that in about 15 minutes when I read your posting. 8)

liveme
Posts: 240
Joined: Thu Aug 27, 2015 5:22 pm
Location: down under

Re: Aligning Bananas and Numbers in a single (Text) field - doable ?

Post by liveme » Sat Apr 17, 2021 7:19 am

Bravo :!: :!: :!:

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 875
Joined: Wed Nov 22, 2006 3:42 pm

Re: Aligning Bananas and Numbers in a single (Text) field - doable ?

Post by Thierry » Sat Apr 17, 2021 7:23 am

liveme wrote: Really cool, I like that the stack holds the Icons themselves... no external images storage !
Yep, that's why I told you to check the dictionary for the options...


BTW Thierry... you seem to know how to setup a socket connection...
Well, knowing sockets is one thing,
knowing how to work with sockets in LiveCode is another thing.
So, it depends...
Would you know what are the Pro/Cons using socket vs my actual (?) connection type ?
I've never used socket before...
I can't give you an easy answer as you've opened kind of pandora box,
but a reasonable suggestion could be
that you learn first what are sockets and then practice a bit.

I believe there are a couple of stacks available from Devin Assay for a simple client - server,
or find out a chat server stack from Bvg ( I guess he was using sockets too)

Have a nice week-end,

Thierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!

liveme
Posts: 240
Joined: Thu Aug 27, 2015 5:22 pm
Location: down under

Re: Aligning Bananas and Numbers in a single (Text) field - doable ?

Post by liveme » Sat Apr 17, 2021 9:43 am

okie..i'll see what I can find...!
tks

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”