Forum Index
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 

Image Bar (%ib) buttons.
Goto page Previous  1, 2
Post new topic   Reply to topic Forum Index -> Suggestions
View previous topic :: View next topic  
Author Message
Site Admin

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

PostPosted: Mon Feb 04, 2008 11:24 pm    Post subject: Reply with quote

OK thanks.
Back to top
View user's profile Send private message AIM Address

Joined: 17 Dec 2006
Posts: 481
Location: Sunderland

PostPosted: Sun May 04, 2008 12:15 pm    Post subject: Reply with quote


I have recently had a battle with the positioning of window controls and so I've modified Paul's code a little to show positioning of %ib controls using

A couple of problems to overcome first. The get_window_location@ actually returns the position of a control relative to the top left corner of the window, but the move_window@ is relative to the first pixel under the caption bar and to the right of the LH border. These of course vary with text size and windows style (standard or XP for example). It there is a %mn then it is the first pixel below the menu.

What I did, and there is probably a better way was to construct a dummy window on startup, which places a caption and a menu, followed by an %rd control. Using a %sc callback, which returns 0, closing the dummy window, I position the %rd to 0,0 and get its position. Add 1 to the x & y positions and use this as the offset from the top of the overall window. Subsequently the get_real_control_location routine simply subtracts these from the get_window_location@ positions to get a location relative to the first usable space. This can then be used to set the %ib or any other control to a new location. After a window resize, the overall window size could be adjusted to account for any dramatic repositioning of controls that you have carried out.

I know it is a bit long winded, but it might help.

Is there any way to get the locations relative to the same point that move_window@ uses?



include <windows.ins>

INTEGER i,iresize,iget_offsets,imove_ib2
external iresize,iget_offsets,imove_ib2
!dummy window
i=winio@('%mn[File[Exit]]&','EXIT') !include this line only if real window is to contain a menu

! real window
i=winio@('%ca[Image bar]%ww%bg[btnface]%hw&',ihandle_window)
i=winio@('%3ib[flat]&','cut/Cut',4,'CONTINUE','copy/Copy',4,'CONTINUE', 'paste/Paste',4,'CONTINUE')
i=winio@('%ff%^tt[Move IB2]&',imove_ib2)


integer*4 function iresize()
include <windows.ins>
! get new position & size of overall window
call get_real_control_location(ihandle_window,ix,iy,iw,ih)
print *,'window',ix,iy,iw,ih
! get new position & size of first ib block
call get_real_control_location(ihandle_ib1,ix,iy,iw,ih)
print *,'ib 1 ',ix,iy,iw,ih
! get new position & size of second ib block
call get_real_control_location(ihandle_ib2,ix,iy,iw,ih)
print *,'ib 2 ',ix,iy,iw,ih
! get new position & size of text button
call get_real_control_location(ihandle_tt,ix,iy,iw,ih)
print *,'tt ',ix,iy,iw,ih

iresize = 1

! get initial offsets using dummy window
integer*4 function iget_offsets()
include <windows.ins>
! set the %rd pixel location to zero,zero
call MOVE_WINDOW@( ihandle_window, 0,0)

call GET_WINDOW_LOCATION@( ihandle_window, ixoffset, iyoffset, iw, ih)
Back to top
View user's profile Send private message Send e-mail

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

PostPosted: Mon May 12, 2008 2:10 pm    Post subject: Reply with quote

Hi Ian,

A very elegant solution, and very timely because of the post by Catherine Rees Lay in the other forum. Your code there isn't truncated.

I eventually discovered %bx, which locks the second %ib into a fixed position. If one puts i=winio@('%ib&',0.0D0) into your code, for instance, the coords of ib2 don't alter when the window is resized.

As written, if one resizes the window, so that ib2 scoots off behind ib1, so too does the %se separator, so presumably that needs to be resurrected in the right position too.


Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Forum Index -> Suggestions All times are GMT + 1 Hour
Goto page Previous  1, 2
Page 2 of 2

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