BBC BASIC for Windows
« Calculated output to combobox »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 11:21pm



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: Calculated output to combobox  (Read 829 times)
ady
Junior Member
ImageImage


member is offline

Avatar




PM


Posts: 55
xx Calculated output to combobox
« Thread started on: Nov 30th, 2013, 11:15am »

I can go from the Win dialogue box to the program now and calculate my numbers but I want to retrieve my numbers from a DIM ABC(50) type array and display them in a

PROC_combobox(Dlg%, "ABCDE", 155, 10, 190, 200, 100, &1)

type combobox in the bottom of the main Win dialogue box so a user can review the outputs

Which functions should I be looking at for this sort of thing?

Thanks in advance for any pointers/examples
« Last Edit: Nov 30th, 2013, 11:26am by ady » User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Calculated output to combobox
« Reply #1 on: Nov 30th, 2013, 2:13pm »

on Nov 30th, 2013, 11:15am, ady wrote:
Which functions should I be looking at for this sort of thing?

What you want is the GUILIB library, which will make this kind of thing straightforward, but which I'm still waiting for somebody to write!!

In the meantime you'll have to do it using the methods documented in the main Help manual. Have you already tried them and failed?

http://www.bbcbasic.co.uk/bbcwin/manual/bbcwing.html#fncombo

To enter a list of strings into a combo box do:

Code:
CB_ADDSTRING = 323
SYS "SendMessage", hbox%, CB_ADDSTRING, 0, "Combobox item 0"
SYS "SendMessage", hbox%, CB_ADDSTRING, 0, "Combobox item 1"
etc. 

Incidentally you referred to a "main Win dialogue box" which is a bit mixed up - it's either the main window or a dialogue box. I've assumed that you mean the former, but if your combobox is in a dialogue box you can find the code for that in the Help manual too.

Richard.
User IP Logged

ady
Junior Member
ImageImage


member is offline

Avatar




PM


Posts: 55
xx Re: Calculated output to combobox
« Reply #2 on: Nov 30th, 2013, 3:07pm »

Cheers

I have the dialogue box allowing user input, and once it's in there a "compute" button gets pressed

This loads the data in to get crunched and the answer output to an array

I have my array ready to print out in the dialogue box and I'm trying to get the combobox to read the data array and print it for the user to read within the combobox

The combobox is where the answer gets printed

That's where I'm stuck

Perhaps I would be better printing the answer to a .txt file and the combobox "reads" the file?
« Last Edit: Nov 30th, 2013, 3:33pm by ady » User IP Logged

ady
Junior Member
ImageImage


member is offline

Avatar




PM


Posts: 55
xx Re: Calculated output to combobox
« Reply #3 on: Nov 30th, 2013, 4:00pm »

PROC_combobox(Dlg%, "",165, 10, 190, 200, 65, &1)

A$="ggggggggg"

SYS "SetDlgItemText", !dlg%,165,A$

Shouldn't gggggggg get printed in the box?


http://www.bbcbasic.co.uk/bbcwin/manual/bbcwing.html#initdialog

I've tried
SYS "SetDlgItemText", !dlg%,165,A$

both before and after

PROC_showdialog(Dlg%)

There's only one dialogue box, so no confusion (lol)

(Tried SYS "SetDlgItemTextA", !dlg%,165,A$ as well)
« Last Edit: Nov 30th, 2013, 4:27pm by ady » User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Calculated output to combobox
« Reply #4 on: Nov 30th, 2013, 4:44pm »

on Nov 30th, 2013, 4:00pm, ady wrote:
Shouldn't gggggggg get printed in the box?

No. A combobox is a combination of an edit control and a list control. Your code would have worked if you had sent the text to the edit control, but you didn't - you sent it to the combobox itself.

I still don't understand why you're not simply using the code listed in the BB4W Help documentation. That works fine, and you just seem to be making your life harder by trying to reinvent the wheel.

There's an example of the use of that code in the DLGDEMO.BBC program supplied with BB4W (EXAMPLES\WINDOWS folder).

Incidentally, is there some specific reason why you're using a combobox rather than a listbox?

Richard.
User IP Logged

ady
Junior Member
ImageImage


member is offline

Avatar




PM


Posts: 55
xx Re: Calculated output to combobox
« Reply #5 on: Nov 30th, 2013, 5:18pm »

I'll use anything.... if it works
I'm just trying to build a simple windows widget which will accept dynamic outputs

PROC_editbox(Dlg%, "Text box",165, 10, 190, 200, 65, &1)

A$="ggggggggg"

SYS "SetDlgItemText",!dlg%,165,A$

Doesn't work either

The DLG example gives outputs only, is there an example with inputs, which dynamically change and then it displays the new outputs

The edit box changes on the final output to the screen but it would be more useful if there was a routine which copied the users input to an output somewhere else on the dialogue box
« Last Edit: Nov 30th, 2013, 5:47pm by ady » User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Calculated output to combobox
« Reply #6 on: Nov 30th, 2013, 6:03pm »

on Nov 30th, 2013, 5:18pm, ady wrote:
The DLG example gives outputs only

That's incorrect, it shows both inputs and outputs! It has this code to enter data into the combobox:

Code:
      SYS "SendDlgItemMessage", !dlg%, 103, CB_ADDSTRING, 0, "Combobox 1"
      SYS "SendDlgItemMessage", !dlg%, 103, CB_ADDSTRING, 0, "Combobox 2"
      SYS "SendDlgItemMessage", !dlg%, 103, CB_ADDSTRING, 0, "Combobox 3"
      SYS "SendDlgItemMessage", !dlg%, 103, CB_ADDSTRING, 0, "Combobox 4"
      SYS "SendDlgItemMessage", !dlg%, 103, CB_SETCURSEL, 0, 0 

And it has this code to extract data from the combobox:

Code:
        DIM text% 255
        SYS "GetDlgItemText", !dlg%, 103, text%, 255
        PRINT "Combobox selection was """$$text%"""" 

Can't you adapt this code to your requirements?

Richard.
User IP Logged

Matt
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 210
xx Re: Calculated output to combobox
« Reply #7 on: Nov 30th, 2013, 8:10pm »

on Nov 30th, 2013, 5:18pm, ady wrote:
PROC_editbox(Dlg%, "Text box",165, 10, 190, 200, 65, &1)

A$="ggggggggg"

SYS "SetDlgItemText",!dlg%,165,A$

Doesn't work either

The main reason for this seems to be that you're not using the same variable: you create the dlg box with Dlg% and try to change it with dlg%. These are not the same. They need to be both dlg% or both Dlg%.

Matt
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Calculated output to combobox
« Reply #8 on: Nov 30th, 2013, 8:37pm »

on Nov 30th, 2013, 8:10pm, Matt wrote:
The main reason for this seems to be that you're not using the same variable: you create the dlg box with Dlg% and try to change it with dlg%.

I noticed that, but the fact remains that you can't write to a combobox that way, so even if the variables had been the same his original code wouldn't have worked (although the textbox version would).

We badly need that GUILIB library!

Richard.
« Last Edit: Nov 30th, 2013, 11:34pm by admin » User IP Logged

ady
Junior Member
ImageImage


member is offline

Avatar




PM


Posts: 55
xx Re: Calculated output to combobox
« Reply #9 on: Dec 1st, 2013, 3:49pm »

Got it sorted using the combobox system, thanks chaps

We badly need that GUILIB library!

Took me 2 days to do a 5 minute job there, definitely agree
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