BBC BASIC for Windows
« WINLIB5 less flexible than WINLIB2 »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 9:56pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: WINLIB5 less flexible than WINLIB2  (Read 668 times)
hellomike
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 46
xx WINLIB5 less flexible than WINLIB2
« Thread started on: Sep 5th, 2015, 3:07pm »

Using the WINLIB5 library I have trouble setting stuff up correctly.
For example:

- How to make use of the same Windows font as is used in Dialog boxes (MS Sans Serif)?
For every new created control the BB4W system font is used. Doing a *FONT first doesn't help.
Must I do a SYS "CreateFont" and then for every new control send also a WM_SETFONT message?

- When creating a control (FN_button()) with BS_AUTORADIOBUTTON or BS_AUTOCHECKBUTTON,
how to enable (check) this control initially? SYS "CheckDlgButton" is not appropriate.
Actually even SYS "EnableWindow" doesn't seem correct.


Code:
      INSTALL @lib$+"WINLIB5"
      BS_AUTOCHECKBOX = 3
      CB%=FN_button("check box",10,10,100,20,101,BS_AUTOCHECKBOX)
      SYS "EnableWindow",CB%,1
      END  


- Same, how to check the state for these type of buttons?

There should be a WINLIB5 equivalent (or is there) for the DLGDEMO.BBC example program...

Of course I know that it's not a shortcoming of the library but rather that dialogue templates work
different than created (child) windows inside @hwnd%.

Hope more experienced people can provide some tips.

Mike
User IP Logged

hellomike
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 46
xx Re: WINLIB5 less flexible than WINLIB2
« Reply #1 on: Sep 6th, 2015, 9:21pm »

Bit further now about the button states.

Code:
      BM_GETCHECK = &F0
      SYS "SendMessage", windowhandle%, BM_GETCHECK, 0, 0 TO state% 


and

Code:
      BM_SETCHECK = &F1
      SYS "SendMessage", windowhandle%, BM_SETCHECK, state%, 0 


Any more input is highly appreciated.

Mike
« Last Edit: Sep 6th, 2015, 9:22pm by hellomike » User IP Logged

sveinioslo
Developer

member is offline

Avatar




PM


Posts: 64
xx Re: WINLIB5 less flexible than WINLIB2
« Reply #2 on: Sep 9th, 2015, 9:06pm »

Quote:
There should be a WINLIB5 equivalent (or is there) for the DLGDEMO.BBC example program...

Here you go.

Code:
      REM winlib5 version of dlgdemo.bbc
      INSTALL @lib$+"winlib5"

      BM_GETCHECK = &F0
      LB_GETCURSEL = 392
      BM_SETCHECK = &F1
      CB_ADDSTRING = 323
      CB_SETCURSEL = 334
      LB_ADDSTRING = 384
      UDM_SETRANGE = &465
      BS_AUTOCHECKBOX = 3
      BS_AUTORADIOBUTTON = 9
      CBS_DROPDOWNLIST = 3
      ES_AUTOHSCROLL = &80
      ES_NUMBER = 8192
      WS_BORDER = &800000
      WS_GROUP = &20000

      Gr%= FN_button("Group box",100,10,260,160,0,WS_GROUP+7)

      Ed1%=FN_editbox("Text box",120,30,105,20,101,ES_AUTOHSCROLL+WS_BORDER)
      Ed2%=FN_editbox("",240,30,105,20,101,ES_NUMBER+WS_BORDER)
      Ud%= FN_createwindow("msctls_updown32","",0,0,0,0,109,&96,0)

      Cb%= FN_combobox("",120,60,105,70,103,CBS_DROPDOWNLIST)
      Lb%= FN_listbox("",240,60,105,70,104,WS_BORDER)

      Rb1%=FN_button("Radiobutton 1",120,110,110,16,105,BS_AUTORADIOBUTTON)
      Rb2%=FN_button("Radiobutton 2",120,140,110,16,106,BS_AUTORADIOBUTTON)
      Ch%= FN_button("Checkbox",240,140,110,16,107,BS_AUTOCHECKBOX)

      Pb1%=FN_button("Ok",120,180,90,22,1,0)
      Pb2%=FN_button("Cancel",255,180,90,22,2,0)

      SYS "SendMessage", Cb%, CB_ADDSTRING, 0, "Combobox 1"
      SYS "SendMessage", Cb%, CB_ADDSTRING, 0, "Combobox 2"
      SYS "SendMessage", Cb%, CB_ADDSTRING, 0, "Combobox 3"
      SYS "SendMessage", Cb%, CB_ADDSTRING, 0, "Combobox 4"
      SYS "SendMessage", Cb%, CB_SETCURSEL, 0, 0

      SYS "SendMessage", Lb%, LB_ADDSTRING, 0, "Listbox item 0"
      SYS "SendMessage", Lb%, LB_ADDSTRING, 0, "Listbox item 1"
      SYS "SendMessage", Lb%, LB_ADDSTRING, 0, "Listbox item 2"
      SYS "SendMessage", Lb%, LB_ADDSTRING, 0, "Listbox item 3"

      SYS "SendMessage", Rb1%, BM_SETCHECK, 1, 0
      SYS "SendMessage", Ud%, UDM_SETRANGE, 0, 999

      Click%=0
      ON SYS Click% = @wparam% : RETURN
      REPEAT
        WAIT 1
        click%=0
        SWAP Click%, click%
      UNTIL click%=1 OR click%=2

      IF click%=1 THEN
        PRINTTAB(0,15) "OK pressed, settings were:"'
  
        PRINT "Text box contained """FNgettext(Ed1%)""""
        PRINT "Number box contained ";VAL(FNgettext(Ed2%))
        PRINT "Combobox selection was """FNgettext(Cb%)""""
  
        SYS "SendMessage", Lb%, LB_GETCURSEL, 0, 0 TO sel%
        PRINT "Listbox selection index was ";sel%
  
        SYS "SendMessage", Rb1%, BM_GETCHECK, 0, 0 TO sel%
        IF sel% PRINT "Radiobutton 1 was checked" ELSE PRINT "Radiobutton 2 was checked"
  
        SYS "SendMessage", Ch%, BM_GETCHECK, 0, 0 TO sel%
        IF sel% PRINT "Checkbox was checked" ELSE PRINT "Checkbox was not checked"
      ELSE
        PRINT "Cancel pressed"
      ENDIF
      END

      DEF FNgettext(hbox%)
      LOCAL text%
      DIM text% LOCAL 65535
      SYS "GetWindowText", hbox%, text%, 65535
      = $$text%

 


I am not sure about the font, but my guess is that you can set different font for each item, since they are actually separate windows.
Can't remember how to at the moment.

Svein


« Last Edit: Sep 10th, 2015, 11:29am by sveinioslo » User IP Logged

hellomike
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 46
xx Re: WINLIB5 less flexible than WINLIB2
« Reply #3 on: Sep 10th, 2015, 2:41pm »

Hi Svein,

Thanks for the code. It is very neat!
Although I found out some things already, the confirmation that I'm on the right track is priceless.

Mike
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls