Populate buttons onMouseclick

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

Post Reply
ace
Posts: 4
Joined: Sun Jan 05, 2014 10:56 am

Populate buttons onMouseclick

Post by ace » Sun Jan 12, 2014 1:40 pm

Please help. . .

i want to populate buttons when a certain button is clicked and automatically set their size and location.

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Populate buttons onMouseclick

Post by Klaus » Sun Jan 12, 2014 2:11 pm

Hi ace,

could please answer your other thread (slider zoom inout in case you are still interested?
ace wrote:i want to populate buttons...
If you mean MENUS (popup, option etc...) then this script will create a three line menu in that button:
line 1
line 2
line 3

Code: Select all

...
set the text of btn "the one you want to populate..." to "line 1" & CR & "line 2" & CR & "line 3"
...
ace wrote:... when a certain button is clicked...

Code: Select all

on mouseup
  ## do this and that
end mouseup
ace wrote:... automatically set their size and location.

Code: Select all

...
set the WIDTH of btn "xyz" to 100
set the HEIGHT of btn "xyz" to 80

## or directly set the complete RECT:
## set the RECT of btn "xyz" to 10,10,200,180
set the LOC of btn "xyz" to 500,478
## LOC = abbr. location
...
You really should take a look at these stacks to get the basics of Livecode:
http://www.hyperactivesw.com/revscriptc ... ences.html


Best

Klaus

ace
Posts: 4
Joined: Sun Jan 05, 2014 10:56 am

Re: Populate buttons onMouseclick

Post by ace » Tue Jan 14, 2014 6:37 am

Thanks Sir. That's very helpful
But what i mean is, when a button is .clicked, it will automatically populate new buttons and set their location.

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Populate buttons onMouseclick

Post by Klaus » Tue Jan 14, 2014 12:52 pm

Hi ace,
ace wrote:Thanks Sir. That's very helpful
But what i mean is, when a button is .clicked, it will automatically populate new buttons and set their location.
Well, that is exactly what I wrote!? However only for ONE button!

Could you please explain what you mean and show your efforts in this respect so far?


Best

Klaus

doobox
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 284
Joined: Tue May 24, 2011 11:47 pm

Re: Populate buttons onMouseclick

Post by doobox » Wed Jan 15, 2014 10:30 am

Could you mean "create" new buttons and set there size and location..?

If so in the button script :

Code: Select all

on mouseUp
   repeat with x = 1 to 3
      create button ("newButton" & x)
      set the width of button ("newButton" & x) to 75
      set the height of button ("newButton" & x) to 40
      put x & 00 into tYloc
      set the loc of button ("newButton" & x) to 100,tYloc
   end repeat
end mouseUp

This would create 3 new buttons and set there locations in a vertical column.
Kind Regards
Gary

https://www.doobox.co.uk

Post Reply