Moving page up and down
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Moving page up and down
Hey Guys,
Need some advice, just can't get my head around this one. I'm building a print layout and I have sized it so I have a header and footer printing roughly around my printer. The problem is the depth of my screen is fairly shallow and I would like to scroll up and down my card to make sure its ok before I send it to print.
The obvious way to do this would be to use the scrollbar control. What I don't understand is when I drag the scrollbar across from the palette of controls, how do I then associate the scrollbar to move the content up and down my card.
I was looking into grouping objects and then applying a scrollbar, but as my scripts are building these print cards from scratch, grouping objects seems quite cumbersome, Id rather copy a preformmatted scrollbar control to my page. Does anyone have any ideas how I can implement the scrollbar to my page and get it to display header, body and footer information. A tutorial or sample stack would her perfect. I'll upload a screenshot to show you what I have, you can't see the footer as it goes beyond my screen.
Thanks as always
Jalz
Need some advice, just can't get my head around this one. I'm building a print layout and I have sized it so I have a header and footer printing roughly around my printer. The problem is the depth of my screen is fairly shallow and I would like to scroll up and down my card to make sure its ok before I send it to print.
The obvious way to do this would be to use the scrollbar control. What I don't understand is when I drag the scrollbar across from the palette of controls, how do I then associate the scrollbar to move the content up and down my card.
I was looking into grouping objects and then applying a scrollbar, but as my scripts are building these print cards from scratch, grouping objects seems quite cumbersome, Id rather copy a preformmatted scrollbar control to my page. Does anyone have any ideas how I can implement the scrollbar to my page and get it to display header, body and footer information. A tutorial or sample stack would her perfect. I'll upload a screenshot to show you what I have, you can't see the footer as it goes beyond my screen.
Thanks as always
Jalz
Re: Moving page up and down
Hi Jalz,
I just spent 5 minutes trying to select and group multiple controls and it's not all that difficult.
1) put the long id of the control into a variable
2) set the "selected" of each control to true -- you will have to remove the controls that you don't want in the group e.g. Print button
3) group
4)set the vScrollbar, set the rect, set the lockLocation
Now I guess that's kind of pigheaded of me to say "just" but I'm pretty sure you know most of what I said.
Grouping is probably the fastest way to get what you'd like.
hmmm... how would lockLocation affect a print job, you may have to unlock and formattedHeight, topLeft at print time.
repeat with x = 1 to the number of controls
Simon
I just spent 5 minutes trying to select and group multiple controls and it's not all that difficult.
1) put the long id of the control into a variable
2) set the "selected" of each control to true -- you will have to remove the controls that you don't want in the group e.g. Print button
3) group
4)set the vScrollbar, set the rect, set the lockLocation
Now I guess that's kind of pigheaded of me to say "just" but I'm pretty sure you know most of what I said.
Grouping is probably the fastest way to get what you'd like.
hmmm... how would lockLocation affect a print job, you may have to unlock and formattedHeight, topLeft at print time.
Not really even with on-the-fly page building...cumbersome
repeat with x = 1 to the number of controls
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Moving page up and down
Do you want to see the full card only in development (to make sure it's right) or do you want users to also be able to view it? If it is just for you, you don't need to do any scrolling. Just set the top of the stack in the message box:
Change the number to whatever works. When you're done looking, set the top back to a positive number. Richard Gaskin has a little UI tool that lets you move stacks around without the message box but I don't have a link. Maybe he'll chime in here. I think there are some others that do the same thing too.
LC will truncate the bottom of the window if there isn't enough room to display it all, so just moving the top of the stack may not be enough. You'll need to set the height of the stack to its normal height first, before repositioning the top.
An alternative, which would work for users as well as you, is to play with the scaleFactor property (only available in LC 6.6+):
This will scale the stack to half size so you can see it all. You can change the percentage to whatever looks best.
Code: Select all
set the top of this stack to -200
LC will truncate the bottom of the window if there isn't enough room to display it all, so just moving the top of the stack may not be enough. You'll need to set the height of the stack to its normal height first, before repositioning the top.
An alternative, which would work for users as well as you, is to play with the scaleFactor property (only available in LC 6.6+):
Code: Select all
set the scaleFactor of this stack to 0.5
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Moving page up and down
Hi both,
Thanks for replying. I've implemented the scale factor to see how it works and its not what I am looking for to be honest.
So Im going to bite the bullet and try and get scrollbars to work on my page. I've looked at Simons steps, yes most of them I think I can learn, find out how to do if I don't know them already. However grouping all the items on my layout I'm having trouble with.
I've got some code below. What I am trying to do is create a group called myprintdata and then loop through each object on my layout and add it to that group. The card contains a number of different types of objects, including groups, controls and fields. Using the dictionary I came across selectedObject which seems the right keyword to use for all objects. I couldn't get it work I've tried to use the it keyword as I figured that whilst looping I would be on the object, but again failed to loop through.
Thanks as always
Thanks for replying. I've implemented the scale factor to see how it works and its not what I am looking for to be honest.
So Im going to bite the bullet and try and get scrollbars to work on my page. I've looked at Simons steps, yes most of them I think I can learn, find out how to do if I don't know them already. However grouping all the items on my layout I'm having trouble with.
I've got some code below. What I am trying to do is create a group called myprintdata and then loop through each object on my layout and add it to that group. The card contains a number of different types of objects, including groups, controls and fields. Using the dictionary I came across selectedObject which seems the right keyword to use for all objects. I couldn't get it work I've tried to use the it keyword as I figured that whilst looping I would be on the object, but again failed to loop through.
Code: Select all
create group myprintdata
repeat with x = 1 to the number of controls
--if the short name of the selectedObject <> "print_bar" then group
--put the short name of the control into tName
--answer tName
add it to group myprintdata
end repeat
Re: Moving page up and down
Good stuff!
in your loop use this
Don't forget you'll probably group some controls that you might not want in the scrolling group
Simon
in your loop use this
Code: Select all
set the selected of the long id of control x to true
Code: Select all
if the short name of control x is "Print" then next repeat.
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Moving page up and down
Hi Simon,
Thankyou for your assistance. Your code works awesome, it selects the objects on my layout. The only thing I can’t seem to do is finally group the items selected on my layout, it seems to error at that stage. I would have thought and looking at other examples online, group is the keyword I should be using to group the selected items but I'm obviously doing something wrong.
Thanks
Jalz
Thankyou for your assistance. Your code works awesome, it selects the objects on my layout. The only thing I can’t seem to do is finally group the items selected on my layout, it seems to error at that stage. I would have thought and looking at other examples online, group is the keyword I should be using to group the selected items but I'm obviously doing something wrong.
Code: Select all
on mouseUp
repeat with x = 1 to the number of controls
if the short name of control x is "print_bar" then next repeat
set the selected of the long id of control x to true
end repeat
--group –I would have thought this line would have grouped the items. Perhaps I need to put them into a group list?
--if the number of lines of the selectedObject > 1 then group
-- rename the group to "myPrintGroup"
-- set the topleft of group "myPrint"
-- set the height of the group "myPrintGroup" to 400
set the vScrollbar of group "gg" to true
end mouseUp
Jalz
Last edited by jalz on Mon Jun 09, 2014 9:26 pm, edited 1 time in total.
Re: Moving page up and down
Right, "group" is what you want and I''m not sure why it doesn't work. It should. But you can try passing the object list rather than selecting each control.
Code: Select all
repeat with x = 1 to the number of controls
if the short name of control x is "print_bar" then next repeat
put the long id of control x && "and" & space after tList
end repeat
group tList
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Moving page up and down
Hi both,
I'm still encountering errors whilst performing the group. Do
Simons method - "group" I get the following error:
execution error at line 8 (controls don't have the same owner), char 1
-line 8 is the line the contains group
Jacques, method produces the following error
execution error at line 7 (Chunk: error in object expression) near "graphic id 5059 of group id 5058 of card if 5057.."
Thanks
I'm still encountering errors whilst performing the group. Do
Simons method - "group" I get the following error:
execution error at line 8 (controls don't have the same owner), char 1
-line 8 is the line the contains group
Jacques, method produces the following error
execution error at line 7 (Chunk: error in object expression) near "graphic id 5059 of group id 5058 of card if 5057.."
Thanks
Re: Moving page up and down
Hi jalz,
Ahhh... It's trying to group the individual controls that have already been grouped.
Using the long id can you figure out when it's a control already inside a group and do a next repeat? Only select the group not the controls inside.
Simon
Ahhh... It's trying to group the individual controls that have already been grouped.
Using the long id can you figure out when it's a control already inside a group and do a next repeat? Only select the group not the controls inside.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Moving page up and down
Would this (shuffleAbout) be of any help ?
http://forums.livecode.com/viewtopic.ph ... out#p60592
keram
http://forums.livecode.com/viewtopic.ph ... out#p60592
keram
Using the latest stable version of LC Community 6.7.x on Win 7 Home Premium, 64bit