Page 1 of 2

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

Posted: Fri Apr 16, 2021 12:10 am
by liveme
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 :)

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

Posted: Fri Apr 16, 2021 3:57 am
by Thierry
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 13214 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

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

Posted: Fri Apr 16, 2021 5:51 am
by liveme
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:

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

Posted: Fri Apr 16, 2021 9:13 am
by Thierry
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

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

Posted: Fri Apr 16, 2021 12:08 pm
by bogs
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

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

Posted: Fri Apr 16, 2021 1:30 pm
by Thierry
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

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

Posted: Fri Apr 16, 2021 2:26 pm
by richmond62
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

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

Posted: Fri Apr 16, 2021 10:57 pm
by bogs
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:

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

Posted: Sat Apr 17, 2021 2:22 am
by liveme
waow...someone had already made a similar banana/apple formula !!!
Weird...LC saving my day....n the planet !
:wink:

Thanks for this Stack !!

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

Posted: Sat Apr 17, 2021 2:36 am
by liveme
Really cool, I like that the stack holds the Icons themselves... no external images storage !
:idea:

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

Posted: Sat Apr 17, 2021 5:14 am
by liveme
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:

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

Posted: Sat Apr 17, 2021 7:04 am
by richmond62
someone had already made a similar banana/apple formula
Nope: I made that in about 15 minutes when I read your posting. 8)

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

Posted: Sat Apr 17, 2021 7:19 am
by liveme
Bravo :!: :!: :!:

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

Posted: Sat Apr 17, 2021 7:23 am
by Thierry
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

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

Posted: Sat Apr 17, 2021 9:43 am
by liveme
okie..i'll see what I can find...!
tks