I need to place 2 UILabel's right next to each other... Where the first one end the other must start... In Xcode, Obj C I can use CGRectGetMaxX and CGRectGetMaxY... Does Monotouch have these functions since I can't find them at all?
Thanks
The UILabel.Frame got the 4 properties:
.Bottom
.Top
.Left
.Right
So you can get the coordinates to place the UILabels right next to each other pretty easy, by combining them.
Related
I'm doing a project for a year 11 physics class and I'm trying to make a battery that generates electrons. This is the code:
electron = sphere(radius = 1, color = color.yellow, vel = vec(-1,0,0));
while battery.voltage > 0:
eb = electron.clone(pos=vec(0,0,0), vel = vec(-1,0,0));
I'm trying to make "eb" constantly, but it only applies eb.pos = eb.pos + eb.vel * deltat; apply to a the first electron. Is there any way to do this without making 600 different electron objects?
You could change the attribute that is modified directly to the electron object instead of creating it all the time. Apply the modifications to electron and add the computing action in the while. Is it what you meant?
You definitely need to make and move 600 sphere objects in order to have 600 sphere objects move. Your variable "eb" is just the name of the most recently made clone of the original sphere.
I'll advertise that a better place to pose VPython questions is in the VPython forum at
https://groups.google.com/forum/?fromgroups&hl=en#!forum/vpython-users
How do you delete a trail from a moving object (the trail exists out of points)?
I thought that if you,
sphere.retain = 0
sphere.make_trail = False
It would instantly delete the trail. But this ins't true because if you put a:
sleep(50)
after it. You can see that the trail is still there.
Setting s.make_trail = False just means "stop adding points to the trail".
In GlowScript VPython or Jupyter VPython you can say s.clear_trail().
In Classic VPython, s.trail_object is the curve or points object, and you can delete elements of these objects.
I'm trying to make a report by using Crystal Report 7. But I'm having trouble when I tried to make the odd detail become white and the even detail become gray
Here what I've tried
I'm waiting for the answer. Thx
even though it's an old post, maybe some people still need it. I happen to still use cr 7, I use this logic and this works fine.
if right(totext(recordnumber / 2),2) = '00' then White else Black
if right(totext(recordnumber / 2),2) = '00' then true else false
Take a look at this link, this might help you.
http://victoriayudin.com/2009/03/31/alternating-shading-for-lines-in-crystal-reports/
OR
Try this:
if RecordNumber mod 2 = 0 then crWhite else crSilver.
When I play the sound file by itself (in interface) it works fine and plays all the way through. However, when I play it as part of the code (followed by an action) it only plays the first half second. I'm using sound:play-sound-and-wait, so I'm not sure why it isn't working.
extensions [sound] ; I have them in the same folder
to-report mouse-up?
ifelse mouse-down?
[report "false"]
[report "true"]
end
to twirl
if mouse-up?
[ask turtles with [shape = ballerina]
[set shape ballerina-2
twirl]
ask turtles with [shape = ballerina-2]
[set shape ballerina
twirl] ]
end
These are 2 different ballerina's facing different directions. When you switch between them, they look like they're twirling. She keeps doing that until you make her stop
to ballet-box
ask patches [set plabel-color 105] ;gives the background this color
sound:play-sound-and-wait "love.aif" ;this works perfectly fine in interface
twirl ;and then I want the ballerina to twirl until you make her stop
end
Any help would be super appreciated!
Sounds like http://github.com/NetLogo/Sound-Extension/issues/2 or http://github.com/NetLogo/Sound-Extension/issues/3 . I don't think anyone has yet investigated or attempted to fix these issues. I don't think we even know under exactly what circumstances they do or don't occur.
I know, silly question, but I am not a programmer and really need to known...
to look-for-food
if food > 0
[ set color orange + 1
set food food - 1
rt 180
stop ]
if (chemical >= 0.05) and (chemical < 2)
[ uphill-chemical ]
end
Thanks
This language is called LOGO. It's often used with Turtle -- drawing lines on the screen.
Related Anecdote:
My first encounter with a computer was around 1985, in my classroom we had an Apple (Apple ][ probably?). This was one of the main programs that was available. I had learned how to do to in order to define a subroutine. I tried it once, but I couldn't remember the syntax for defining the specifics. And then when I tried to exit the to routine definition context, I couldn't remember how to exit it. The teacher could sense that I was confused, and was coming over to help me. I figured I'd be in trouble for straying beyond the scope of the exercise that I was supposed to be working on, and figured the teacher wouldn't know how to recover either. I panicked and powered off the computer. My first "did you try turning it off and on again?" experience! :)