soccer jersey forums.silverfrost.com :: View topic - %ob changes shape/position as window is resized
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 

%ob changes shape/position as window is resized
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
wahorger



Joined: 13 Oct 2014
Posts: 1226
Location: Morrison, CO, USA

PostPosted: Sat Jan 07, 2023 2:18 pm    Post subject: %ob changes shape/position as window is resized Reply with quote

The Plato project containing the two files and project description is on DropBox at this link:
https://www.dropbox.com/t/TlFlkMKPrWq0G5aG

This is a little test program to understand how to use %gr and to test various user interface options.

The application was to use a set of buttons on the left side to control the actions of the eventual data (using %ob) to contain the controls. The graphic object area contains one drawn object of a much smaller width than the graphic area.

When I resize the window, the %ob can change shape and the controls can disappear off of the top of the window (resizing the window smaller). Reestablishing the window at its original size or larger works fine.

In one iteration of the testing (not in this test program), I used %ap to fix the initial positions of the %ob at (1,1) and %gr at (15,5). With the %gr positioned so its upper left corner is at the same or near position as the third button (as with these %ap data), then resizing the window affects the %ob differently. It still messes stuff and ordering up, just differently.

I don't know if this is expected behavior or not, nor how I should attempt to redefine how the various controls should be working to prevent this. It may be that %ob is a bad choice, and I can accept that!
Back to top
View user's profile Send private message Visit poster's website
wahorger



Joined: 13 Oct 2014
Posts: 1226
Location: Morrison, CO, USA

PostPosted: Sat Jan 07, 2023 5:36 pm    Post subject: Reply with quote

Here's a video link that shows what happens.

https://capture.dropbox.com/WMphHaoXO71dpE6h

Bill
Back to top
View user's profile Send private message Visit poster's website
LitusSaxonicum



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

PostPosted: Sat Jan 07, 2023 7:53 pm    Post subject: Reply with quote

I think that the answer is not to use a box or set of boxes containing %bt buttons, but instead to use %ib or %tb. Personally, I like the effects possible with %tb better than %ib, but %tb is more work as it needs a lot of icons to be drawn, whereas %ib generates the necessary variations automatically. However, %ib�s version of �greyed out� is often unsatisfying. However, for toolbar buttons that are never greyed out, they can look great. (You might even be able to use %mb).

Sadly, all three options are more complicated than using %bt buttons.

Apologies for not explaining the behaviour your demonstrator exhibits, but rather my suggestion is to get the behaviour you have asked for.

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



Joined: 18 May 2012
Posts: 717
Location: Hamilton, Lanarkshire, Scotland.

PostPosted: Sat Jan 07, 2023 9:38 pm    Post subject: Reply with quote

I have run into to the same problem. No amount of nesting hidden boxes appears to help in this case. To overcome this I have used either a menu item or a mouse click in the graphics region to cause the required buttons to �pop� up.

Code:
program bill
use clrwin
implicit none
integer iw
integer gr_cb ; external gr_cb
iw = winio@('%mn[Exit]&','exit')
iw = winio@('%mn[Buttons]&', gr_cb)
iw = winio@('%pv%^gr[blue]&', 500,500, gr_cb)
iw = winio@('')
end program bill

integer function gr_cb()
use clrwin
integer iw
  if (     trim(clearwin_string@('CALLBACK_REASON')) .eq. 'MOUSE_RIGHT_CLICK' &
      .OR. trim(clearwin_string@('CALLBACK_REASON')) .eq. 'MENU_SELECTION'      ) then
    iw = winio@('%ww[no_caption]&')
    iw = winio@('%1.5ob&')
    iw = winio@('%bt[1]%cb&')
    iw = winio@('%bt[2]%cb&')
    iw = winio@('%bt[3]%cb&')
    iw = winio@('%bt[4]%cb&')
    iw = winio@('%bt[5]%cb')
  end if
  gr_cb = 2
end function gr_cb
Back to top
View user's profile Send private message Visit poster's website
Kenneth_Smith



Joined: 18 May 2012
Posts: 717
Location: Hamilton, Lanarkshire, Scotland.

PostPosted: Sat Jan 07, 2023 11:47 pm    Post subject: Reply with quote

Or using %pm:

Code:
program bill2
use clrwin
implicit none
integer iw
integer  cb_1, cb_2, cb_3
external cb_1, cb_2, cb_3
iw = winio@('%mn[Exit]&','exit')
iw = winio@('%pm[1,2,3]&', cb_1,cb_2,cb_3)
iw = winio@('Right click outside graphics region to pop up menu%2nl%2ta%pv%gr[blue,full_mouse_input]&', 500,500)
iw = winio@('')
end program bill2

integer function cb_1()
print*, 'cb_1'
cb_1 = 2
end function cb_1

integer function cb_2()
print*, 'cb_2'
cb_2 = 2
end function cb_2

integer function cb_3()
print*, 'cb_3'
cb_3 = 2
end function cb_3
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


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

PostPosted: Sun Jan 08, 2023 9:21 am    Post subject: Reply with quote

This first thing is to put %ff before %pv. Then you could change from %1.5ob to %5.1ob or omit the %ob or use a toolbar.

My personal preference is to use %mb for toolbars.
Back to top
View user's profile Send private message AIM Address
wahorger



Joined: 13 Oct 2014
Posts: 1226
Location: Morrison, CO, USA

PostPosted: Sun Jan 08, 2023 5:55 pm    Post subject: Reply with quote

Paul, thanks for the hints.

I am going with a toolbar instead of buttons. Looking at pop-up menus as well.

I see that %mb is preferred over %ib; I think %ib will also give me what I'm looking for.

%mb looks (initially) like a lot of work. I don't understand what a "strip" of images would look like in my image editor. I know about stacking of images (in icons, I have a great icon editor that makes this really easy). I'll look for a deeper explanation with examples, maybe within MSDN.

Bill
Back to top
View user's profile Send private message Visit poster's website
DanRRight



Joined: 10 Mar 2008
Posts: 2867
Location: South Pole, Antarctica

PostPosted: Sun Jan 08, 2023 9:28 pm    Post subject: Reply with quote

Bill,
Respect to your video. Have you tried to add just this line with two controls before your %ob ?

i=winio@('%nd%nr&')

And because %ob also slides make it

%1.5ob[invisible].

Or there already should be an option which also prevents %ob from sliding when resizing (at least i remember we discussed it few years back)


Last edited by DanRRight on Sun Jan 08, 2023 10:29 pm; edited 2 times in total
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Sun Jan 08, 2023 9:55 pm    Post subject: Reply with quote

Bill

%mb uses a Microsoft toolbar that provides standard image lists so for many purposes you don't need to create your own.

The most recent Youtube ClearWin+ video illustrates this.
Back to top
View user's profile Send private message AIM Address
LitusSaxonicum



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

PostPosted: Mon Jan 09, 2023 12:32 pm    Post subject: Reply with quote

FTN95.CHM tells us that %tb has been superseded by %ib which in turn, has been superseded by %mb. I�m not entirely sure that this is correct nor that it is necessarily good advice.
Contrasting first %tb and %ib, the big advantage of the latter is that you only need to draw one icon and the other states are generated automatically. The downside or disadvantage of the automatic generation of the other icon states is that particularly in the case of the �greyed-out� state, the icon has to be very carefully drawn if you are not to end up with a horrid amorphous looking grey blob*. Moreover, %ib (in all its options) generates toolbar buttons that have an appearance that matches past versions of Windows and not the current paradigm. Using %tb, you have to draw the icons for all of the states and therefore can have any appearance that you like for not just the greyed-out version but also how the button responds to being clicked or selected. Therefore, at the expense of drawing all the icons, you can have any appearance you like as well as conforming to the latest version of Windows.
%ib does have the advantage of allowing you to attach a short text string to appear as part of the button but this can only be underneath the icon not alongside, which makes the toolbar higher than one might otherwise like. I have found that it is useful to look at the aspect ratio of the screen to decide whether a toolbar should be along the top or down the left-hand side, as these two locations are relatively free from problems when the screen is resized, although resizing beyond a certain point will lose part of the toolbar. Moreover, when using a toolbar down the left-hand side of the screen it is worth checking the pixel height of the screen and opting not to have the text with the toolbar buttons if using it means that all the buttons cannot be shown.
Turning now to %mb, I have yet to completely master the complicated syntax (and by �completely master� you may read that I haven�t much of a clue!). This control also uses automatic generation of various button states, which again gives rise to the �greyed-out� appearance problem with user-drawn icons, and the standard Microsoft image strips may well overcome this problem, but they are individually very small (which is a past paradigm) and have the now superseded appearance. It isn�t clear how to draw the rows of icons (image strips), and the standard image strips are great for toolbars that emulate the contents of the File menu (e.g. New, Open, Save etc) but for the purpose of interacting with a drawing surface, you will simply need to draw your own icons, as MS have not provided useful icons for such things as �Add another stratum� (geologist), �Add a resistor�, �Add a column or beam� etc. Most of us struggle to draw such things, and my experience suggests that with all the other things one needs to program, it may take years to make the icons both small and consistently coloured � in some cases I have gone through a dozen or more versions en route! It�s hard enough to draw even those recognisably standard File menu icons, let alone something a user might identify readily with its intended function!

*The greyed-out %ib state has a limited range of greys. The trick is to fill some of the icon with a checkerboard pattern using the real icon colour (X) and the background colour (O) like this:
XOXOX
OXOXO
XOXOX
Which will give the appearance of another grey shade, although it does mute the colour of the icon. %tb allows you to draw the greyed-out state with lots of grey shades.
Back to top
View user's profile Send private message
wahorger



Joined: 13 Oct 2014
Posts: 1226
Location: Morrison, CO, USA

PostPosted: Mon Jan 09, 2023 4:37 pm    Post subject: Reply with quote

Paul,

Thanks for the pointer to the video. I will take a look.

Dan,

Yes, %nd and %nr prevent the controls from moving, but not the %ob. And, yes, making it invisible removes the disturbing visual.

Thanks for the hint! I can use this elsewhere.

LitusSaxonicum,

I encountered some of the same issues as you as I explored the %mb. For many, the "standard" image strips might be applicable. In my application, however, the images would likely be something different. For example, an icon that signifies a horizontal scale change (press to change to one of a set of "standard" scaling"), or a button to reveal additional data about an object that had been drawn or selected. I don't know exactly what is in these "strips" nor how to access them by name, either.

The exploring I am doing is the start of a new application that does some of what an older app did do, and adds additional functionality. The older app is written in Java, and I do not have the source to use as a guide. That said, the older app has only 7 possible actions driven by a menu selection on the left hand side, so fitting the selections isn't an issue. I'm likely to expand that a bit. %ib gives me most, if not all, of what I imagine I might need.
Back to top
View user's profile Send private message Visit poster's website
LitusSaxonicum



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

PostPosted: Mon Jan 09, 2023 5:44 pm    Post subject: Reply with quote

... and I forgot to add that %ib can also detect and respond to a mouseover event, which may allow you to pop up an additional toolbar, so that your 7 actions could be multiplied. I doubt from your description that you'll need the greyed-out icon.

As to %mb, I'm sure that I would use it if I had to produce a suite of applications, all of which needed the icons in a Microsoft standard image strip.

Eddie
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Mon Jan 09, 2023 7:40 pm    Post subject: Reply with quote

At some point I would like to make a Youtube video on using %mb. I know that it is off-putting but when you know what to do it is both relatively simple to set up and potentially very powerful.
Back to top
View user's profile Send private message AIM Address
LitusSaxonicum



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

PostPosted: Mon Jan 09, 2023 8:11 pm    Post subject: Reply with quote

Paul,

Please tell us how to draw an image strip. Is it just the equivalent of a set of the images for %ib drawn as one image?

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



Joined: 13 Oct 2014
Posts: 1226
Location: Morrison, CO, USA

PostPosted: Mon Jan 09, 2023 11:38 pm    Post subject: Reply with quote

Paul, totally agree!

It would fit in well with what I'm intending on doing. I'm going to start with %ib; I can always go to %mb later!

Bill
Back to top
View user's profile Send private message Visit poster's website
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  Next
Page 1 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