Silverfrost Forums

Welcome to our forums

WINSTYLE issue

10 Sep 2019 5:24 #24329

I was playing around with child windows and wanted to add a 'standard' background color using the WINSTYLE@ function. Using it, however, caused a crash 'unused arguments' at run-time in line 8 (the %sh).

	winapp
    program main
	use mswin
	integer:: ii, ctrl, wd=-999, ht=-999,x=-999,y=-999
    integer,external:: call_back
	!child window with controls...
    call winstyle@('%bg[white]&')
	ii=winio@('%sh&',ctrl)
	ii=winio@('%bt[Button]&')
	ii=winio@('%bt[Button]&')
	ii=winio@('%bt[Button]&')
	ii=winio@('%bt[Button]&')
	ii=winio@('%bt[Button]&')
	ii=winio@('%bt[Button]&')
	ii=winio@('%bt[Button]%nl&')
	ii=winio@('%bt[Button]%nl&')
	ii=winio@('%bt[Button]%nl&')
	ii=winio@('%bt[Button]%nl&')
	ii=winio@('%bt[Button]%nl&')
	ii=winio@('%bt[Button]%nl&')
	ii=winio@('%bt[Button]%nl&')
	ii=winio@('%bt[Button]%nl&')
	ii=winio@('%bt[Button]%nl&')
	ii=winio@('%bt[Button]%nl&')
	ii=winio@('%bt[Button]&')
	ii=winio@(' ')
    call get_window_location@(ctrl,x,y,wd,ht)
    	print *,x,y,wd,ht
	!Main window to display child with vertical scroll bar...
	wd = 280; ht = 150
	ii=winio@('%ww[not_fixed_size]%sz&',wd,ht)
!    ii = winio@('%`mv&',call_back)
	ii=winio@('%ch[hscrollbar,vscrollbar]',ctrl)
    end
	integer function call_back()
    use mswin
    character*32:: callback_reason
    call_back = 1
    callback_reason=clearwin_string@('CALLBACK_REASON')
    print *,callback_reason
    return
    end

    
10 Sep 2019 5:51 #24330

Yes. It appears that winstyle@ does not work in this context. I will make a note to investigate whether or not it can be fixed.

10 Sep 2019 11:13 #24332

John,

It also shows used in the example. So, naturally....

10 Sep 2019 11:19 #24333

Paul,

I also tried it right before the %ww. Didn't work there either.

But, if it doesn't work at all, I'm OK with that. I'm thinking that a function that does the setup works in my case. WINSTYLE@ would be nice, but is not necessary for me. I can certainly see it for others!

Bill

11 Sep 2019 5:42 #24335

Bill

I haven't checked it out yet but I am hoping that it only fails with %sh.

If anyone has the time to test it (without %sh) then please let me know how you get on.

11 Sep 2019 1:23 #24337

It doesn't appear to work with just the %ww either.

11 Sep 2019 2:57 #24338

Is that %ww with %sh? Can you provide an example? Does it work at all?

11 Sep 2019 3:03 #24339
	winapp
    program main
	use mswin
	integer:: ii,wd,ht
    call winstyle@('%tc[RED]&')
	wd = 280; ht = 150
	ii=winio@('%ww[not_fixed_size]%sz&',wd,ht)
	II = WINIO@('%BT[tEST]')
    end

This fails with 'Unused Arguments in winio@ call'.

12 Sep 2019 1:55 #24347

This has now been fixed for the next release of the DLLs.

In the case of %ww you can work around the problem by avoiding extra arguments (after the format) in the first call to winio@.

ii=winio@('%ww[not_fixed_size]%sz&',wd,ht)

becomes:

ii=winio@('%ww[not_fixed_size]&') ii=winio@('%sz&',wd,ht)

If necessary, for %sh you could precede with

ii=winio@(' &')

or maybe change the order.

12 Sep 2019 2:39 #24348

Thanks, Paul!

12 Sep 2019 2:58 #24349

The above fix and work-around turns out to be for 64 bits only.

The 32 bit case has now been fixed but the above work-around may not be effective in this case.

14 Sep 2019 6:48 #24356

It is a bug and it has now been fixed for the next release. The documentation is correct apart from the fact that %bg is missing from the list.

Please login to reply.