forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Scrollable format window?
Goto page 1, 2, 3, 4  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
Wingnut



Joined: 07 Mar 2011
Posts: 6

PostPosted: Wed Apr 20, 2011 8:30 pm    Post subject: Scrollable format window? Reply with quote

Is there a way to scroll a format window? I haven't been able to find one.
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 1880
Location: Yateley, Hants, UK

PostPosted: Fri Apr 22, 2011 5:49 pm    Post subject: Reply with quote

Nobody replied to this?

Only certain controls can be scrolled. They all fit inside a format window (%ca/%ww etc).

The examples I know include graphics windows, some types of text boxes (including %cw), and various drop-down list boxes etc.

If you have so much info that an entire window needs to be scrolled, it looks to me like a case for simplification, or time to buy a much, much, bigger screen!

Taking the example of the Silverfrost Forum display, what you are scrolling is the "client area" within Internet Explorer (say), which is just a big fancy graphic, even though it does look like it has buttons, text boxes etc. that you might be able to duplicate with Clearwin if you tried.

Eddie
Back to top
View user's profile Send private message
silicondale



Joined: 15 Mar 2007
Posts: 216
Location: Matlock, Derbyshire, UK

PostPosted: Thu Oct 31, 2013 4:35 pm    Post subject: Reply with quote

Hi, Eddie... This is something that I'm looking for now, too. I take the point on simplification. And the 'we need a bigger screen' argument. However, what I want to do is run the same software that I've developed on a 'normal' screen and run it on a much smaller screen on a Windows tablet.

Example images attached.


This shows the window as set up for use on a normal screen. Works fine.


I've made it resizable, so it can fit on the smaller screen of an HP Envy pad.
Size is now fine, but I need to scroll it to see all the controls.

Yes, I could re-structure the whole page to use property sheets, but that still doesn't solve the problem, because it's still possible to overflow the size. The number of buttons is variable dependent on the requirements of the particular options chosen.

It would be really good just to be able to attach scroll-bars to the window.

-Steve[/img]
Back to top
View user's profile Send private message Visit poster's website
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 1880
Location: Yateley, Hants, UK

PostPosted: Thu Oct 31, 2013 5:31 pm    Post subject: Reply with quote

Hi Steve,

What about reading in the screen dimensions, and laying out a window to suit? I've done this with some programs to decide that a toolbar across the top should be replaced by one down the side if the smaller screen is widescreen format - which they usually are - or if it is not, then to make the toolbar a popup window of its own.

The calls are:

Code:
       IXRES = GetSystemMetrics(SM_CXSCREEN)
       IYRES = GetSystemMetrics(SM_CYSCREEN)


Up to a point, you can simply make the font smaller, in which case you may be better using a very scalable font like Segoe UI rather than the windows default font.

Eddie
Back to top
View user's profile Send private message
silicondale



Joined: 15 Mar 2007
Posts: 216
Location: Matlock, Derbyshire, UK

PostPosted: Thu Oct 31, 2013 5:49 pm    Post subject: Reply with quote

excellent suggestion, Eddie. Hadn't thought of changing the font but of course that's an obvious thing to do. Changing the window layout is also possible: already thinking I can improve things by using property sheets. I've also cut down the default window border - saves a few more pixels.
Back to top
View user's profile Send private message Visit poster's website
IanLambley



Joined: 17 Dec 2006
Posts: 470
Location: Sunderland

PostPosted: Mon Nov 04, 2013 2:00 pm    Post subject: Reply with quote

Tidying up, font sizing and control positioning can make a huge change to the space you need. Here is a 686 x 564 wide data entry screen for one of my programs. It was a huge effort but lots of data was placed on the screen.


Regarding your display, do you need buttons for each entry description, I use %`ap%`rs to layout the info, with a vertical increment of about 1.3d0 for the %`ap. The %`rs (for output) and %`bg[white]%rf for input are set to a slightly different height to maintain the alignment.
the %ob titles are actually %`rs controls overlaying the box boundaries as it seems that for a multiple %ob you cannot have multiple titles.

The controls in the boxes on your display could be moved up using less %ff and %nl codes.
I hope this helps.
Ian
Back to top
View user's profile Send private message Send e-mail
silicondale



Joined: 15 Mar 2007
Posts: 216
Location: Matlock, Derbyshire, UK

PostPosted: Mon Nov 04, 2013 4:20 pm    Post subject: Reply with quote

Ian - that is an excellent example. In reply to your question about buttons. No I don't really need them. I was using them to get callbacks to a system dialog (for file names) and a popup window with a dropdown list (for field names) but neither really needs to be done via buttons, and the fieldname selection would be much simpler through %ls. Could save a lot of space!
Back to top
View user's profile Send private message Visit poster's website
silicondale



Joined: 15 Mar 2007
Posts: 216
Location: Matlock, Derbyshire, UK

PostPosted: Fri Nov 15, 2013 6:21 pm    Post subject: Reply with quote

Actually, just returned to this after a break (a paying consultancy project Very Happy ), and I think I do need buttons after all - unless you can attach bubble help or tooltips to something other than the %bt and %tt controls. However, I guess I could squash them closer together by using absolute positioning.
Back to top
View user's profile Send private message Visit poster's website
jalih



Joined: 30 Jul 2012
Posts: 190

PostPosted: Fri Nov 15, 2013 8:22 pm    Post subject: Reply with quote

Actually, I think that with a little bit of work and help from winapi you could scroll the window.

I haven't tried any of this, but steps would be something like:

1. You need a handle of the window.

2. Use SetWindowLongPtr() to modify window styles (WS_HSCROLL, WS_VSCROLL).

3. You need to handle the WM_SIZE message and set new page size for scrollbars.

4. You need to handle the WM_HSCROLL and WM_VSCROLL messages. Scroll the window client area by requested amount with ScrollWindow() and update current scrolling position.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 5609
Location: Salford, UK

PostPosted: Sat Nov 16, 2013 3:04 pm    Post subject: Reply with quote

Here is a sample program that could be developed.
At the moment it just has two buttons in a scrolling window.
I think that %vs is undocumented - it is like %vx.
The program only uses ClearWin+ format codes that have been available for a long time.

Code:
!FTN95$WINAPP
module vv
integer hwnd,chwnd,oldy,yscroll
end module vv

integer function vcb()
  use vv
  include <windows.ins>
  integer x,y,w,h,diff,child
  diff = 10*(yscroll - oldy)
  oldy = yscroll
  child = GetWindow(GetParent(chwnd), GW_CHILD);
  do while(child /= 0)
    call get_window_location@(child, x, y, w, h);
    call move_window@(child, x, y - diff);
    child = GetWindow(child, GW_HWNDNEXT)
  end do 
  vcb = 2
end function

integer function sc()
  use vv
  include <windows.ins>
  integer x,y,w,h
  call get_window_location@(hwnd, x, y, w, h)
  call resize_window@(hwnd, w, 100)
  sc = 2
end function

program main
  use vv
  include <windows.ins>
  integer ii, ctrl, step, max
  integer,external::sc,vcb
  step = 1
  max = 10
  yscroll = 0
  oldy = 0
  !child window with controls...
  ii=winio@("%sh&",ctrl)
  ii=winio@("%bb[OK]&")
  ii=winio@("%lc&", chwnd)
  ii=winio@("%3nl%bb[Cancel]")
  !main window to display child with vertical scroll bar...
  ii=winio@("%ww%ca[Scroll demo]&")
  ii=winio@("%ch&",ctrl)
  ii=winio@("%hw&",hwnd)
  ii=winio@("%sc&",sc)
  ii=winio@("%^vs", step, max, yscroll, vcb);
end program

RESOURCES
1 24 default.manifest
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 5609
Location: Salford, UK

PostPosted: Sat Nov 16, 2013 6:43 pm    Post subject: Reply with quote

Same program tidied up a bit...

Code:
!FTN95$WINAPP
module vv
integer hWND,childHWND,lastyScroll,yScroll
end module vv

integer function vcb()
  use vv
  include <windows.ins>
  integer x,y,w,h,diff,cntlHWND
  diff = 10*(yScroll - lastyScroll)
  lastyScroll = yScroll
  !Move all the grandchildren...
  cntlHWND = GetWindow(childHWND, GW_CHILD);
  do while(cntlhwnd /= 0)
    call get_window_location@(cntlHWND, x, y, w, h);
    call move_window@(cntlHWND, x, y - diff);
    cntlHWND = GetWindow(cntlHWND, GW_HWNDNEXT)
  end do 
  vcb = 2
end function

integer function sc()
  use vv
  include <windows.ins>
  integer x,y,w,h
  call get_window_location@(hWND, x, y, w, h)
  call resize_window@(hWND, w, 100)
  sc = 2
end function

program main
  use vv
  include <windows.ins>
  integer ii, ctrl, step, max
  integer,external::sc,vcb
  step = 1
  max = 10
  yScroll = 0
  lastyScroll = 0
  !child window with controls...
  ii=winio@("%sh&",ctrl)
  ii=winio@("%hw&", childHWND)
  ii=winio@("%bb[OK]&")
  ii=winio@("%3nl%bb[Cancel]")
  !main window to display child with vertical scroll bar...
  ii=winio@("%ww%ca[Scroll demo]&")
  ii=winio@("%ch&",ctrl)
  ii=winio@("%hw&",hWND)
  ii=winio@("%sc&",sc)
  !Match the border to the child background...
  ii=winio@("%bg[BTNFACE]&")
  ii=winio@("%^vs", step, max, yScroll, vcb);
end program

RESOURCES
1 24 default.manifest
Back to top
View user's profile Send private message
silicondale



Joined: 15 Mar 2007
Posts: 216
Location: Matlock, Derbyshire, UK

PostPosted: Sat Nov 16, 2013 6:45 pm    Post subject: Reply with quote

Hi jalih and Paul - interesting ideas, and will try this program, Paul - though not sure I want to dive into native Windows programming - I don't have the skill or courage of jalih!
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 5609
Location: Salford, UK

PostPosted: Sat Nov 16, 2013 11:36 pm    Post subject: Reply with quote

Add a grave accent to %vs (%^`vs), then vcb is also called whilst the "thumb" is dragged.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 5609
Location: Salford, UK

PostPosted: Sun Nov 17, 2013 10:11 pm    Post subject: Reply with quote

Here is the final offering...

Code:
!FTN95$WINAPP
module vv
use mswin
integer y0,lastyScroll,yScroll
integer hwnd

contains
  integer function cb()
    integer d,y
    if(y0 == 0) call get_window_location@(hwnd, d, y0, d, d)
    call get_window_location@(hwnd, d, y, d, d)
    !The scaling factor (10 here) could be adjusted to personal preference and screen resolution.
    call move_window@(hwnd, 0, y-y0+10*(lastyScroll-yScroll))
    lastyScroll = yScroll
    cb = 2
  end function
end module vv

program main
  use vv
  integer ii, ctrl, wd, ht
  yScroll = 0; lastyScroll = 0; y0 = 0
  !Set ht to the desired height of the main window...
  wd = 0;  ht = 150
  !child window with controls...
  ii=winio@("%sh&",ctrl)
  ii=winio@("%hw&", hwnd)
  !Add your controls here...
  ii=winio@("Sample containing scrolling child window..&")
  ii=winio@("%3nl%cn%6bb[OK]&")
  ii=winio@("%3nl%cn%6bb[Cancel]")
  !Main window to display child with vertical scroll bar...
  ii=winio@("%ww[no_border,no_maxbox]%ca[Scroll demo]&")
  ii=winio@("%ch&",ctrl)
  ii=winio@("%sz&",wd,ht)
  !Match background to the child background...
  ii=winio@("%bg[BTNFACE]&")
  !The maximum (10 here) is chosen to reflect the number of steps to complete the scrolling process.
  ii=winio@("%^`vs", 1, 10, yScroll, cb);
end program

RESOURCES
1 24 default.manifest
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2007
Location: Sydney

PostPosted: Mon Nov 18, 2013 12:29 am    Post subject: Reply with quote

Paul,

What version of FTN95/Clearwin+ is required for this example ?

John
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Goto page 1, 2, 3, 4  Next
Page 1 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group