BBC BASIC for Windows
Programming >> User Interface >> Fixing the position of a progress bar http://bb4w.conforums.com/index.cgi?board=ui&action=display&num=1409245434 Fixing the position of a progress bar
Post by g3nrw on Aug 28th, 2014, 5:03pm
I have an app containing many controls, whose positions are expressed as x%, y% units relative to the top left hand corner of the window. When I run the app on different systems with different resolution monitors, all the controls appear in the same position relative to each other. No problem.
I have now added a progress bar to the app. It works, but it appears in different positions on different resolution monitors. This is evidently because the position of the bar is expressed as xpos%, ypos%, where these parameters are in pixels relative to the top left hand corner, rather than in x%, y% units.
This is a pain, because the bar appears in different places on different systems, depending on the screen resolution.
Is there any way to express the position of the bar as x%, y% units, as with all the other controls, rather than xpos%, ypos% pixels?
-- Ian Re: Fixing the position of a progress bar
Post by DDRM on Aug 29th, 2014, 08:57am
Hi Ian,
Please can you clarify a little? Does your app put the controls on the main window (e.g. using Winlib5), or are you using a dialogue box (eg. using Winlib2)?
If you are using Winlib5, it looks like control sizes are specified in pixels anyway, as are progress bars in Winlib3.
If you are using Winlib2, have you seen the section in the manual on making a progress bar using
That seems to generate a progress bar in dialogue box units, which scales with other controls as you change font size or screen resolution, at least on my machine and a quick test.
If it's a dialogue box and you aren't using Winlib2, would the MapDialogRect function do what you need?
If you search for "rect" in the help, there's an example (under displaying enhanced metafiles) of how to make and use a rect structure in BB4W to send/receive data from a SYS call, which I guess, but have not tried, should work similarly with this call.
Hope that's helpful,
David Re: Fixing the position of a progress bar
Post by g3nrw on Aug 30th, 2014, 08:35am
Yes, that is what I should have used. I used instead: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ pb% = FN_createprogressbar(@hwnd%, 550, 145, 150, 20, 0) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~