Search found 79 matches

by Zaphod
Sun 16 Sep 2018, 02:00
Forum: Mathematics
Topic: My calculator program
Replies: 4
Views: 3421

Re: My calculator program

An interesting example. Have you noticed that when you put in a number after an evaluation it tags it onto the previous result in the display? Your library must let you make the button color different from the background doesn't it? That would enhance the appearance. Since you have bags of space for...
by Zaphod
Thu 13 Sep 2018, 05:06
Forum: Mathematics
Topic: Calculator (group effort)
Replies: 11
Views: 5645

Re: Calculator (group effort)

UPDATED to Version 3 I had a go at using Michael's shell but had comprehension problems using his libraries so wrote it with just BBC BASIC functions so it should still work on SDL versions, but I have not tested that. It uses the ON MOUSE technique as discussed in another thread. The highlighting o...
by Zaphod
Mon 10 Sep 2018, 18:03
Forum: Mathematics
Topic: Calculator (group effort)
Replies: 11
Views: 5645

Re: Calculator (group effort)

Here is a better fix for the auto repeat. DEFFNabutton(x,y,size%,c$,com$) PRIVATE kd% LOCAL _mx,_my,_mb,ret$ MOUSE _mx,_my,_mb IF _mb=0 kd%=FALSE IF NOT kd% THEN GCOL 5 RECTANGLE x,y,size%, size% IF com$="fill" THEN PROCpaint(x+5,y+5,c$) ENDIF IF _mx>x AND _mx<x+size% AND _my>y AND _my<y+size% THEN ...
by Zaphod
Mon 10 Sep 2018, 13:47
Forum: Mathematics
Topic: Calculator (group effort)
Replies: 11
Views: 5645

Re: Calculator (group effort)

Thanks for the comments. I understand the code but not the reasoning behind it. If you rewrote this as: DEF PROCrect(x0,y0, x1,y1) RECTANGLE x0,y0,x1-x0,y1-y0 ENDPROC it would give the exactly the same result as x0,y0 is the origin, and x1,y1 is the opposite corner. RECTANGLE can have negative width...
by Zaphod
Mon 10 Sep 2018, 01:34
Forum: Mathematics
Topic: Calculator (group effort)
Replies: 11
Views: 5645

Re: Calculator (group effort)

Michael, OK, I added that MOUSE TO x,y and it works so long as you have a steady hand and don't wander a pixel back onto the button, x-5,y-5 would solve that. So I guess that counts as a win. I think there must be better ways rather than having the mouse jump off the button. I tried playing around w...
by Zaphod
Fri 07 Sep 2018, 13:16
Forum: Mathematics
Topic: Calculator (group effort)
Replies: 11
Views: 5645

Re: Calculator (group effort)

Hi Mike. I found a few problems fairly quickly. 1) I get multiple digit entries. Really you should only get one digit per click and suppress the auto repeat. I typically get 2 to 3 numbers per click which makes it unusable. 2) It crashes on line 71 the EVAL frequently. Seems like if you have a numbe...
by Zaphod
Sun 19 Aug 2018, 22:45
Forum: Graphics and Games
Topic: Listbox Selecting
Replies: 8
Views: 3469

Re: Listbox Selecting

Here is a short example program selecting list box items and using a minimal interrupt buffer. It does not suffer the problems that you were experiencing Matt. Note also that the LBS_NOTIFY style that I mentioned previously is already set out of the box in WINLIB2, something I had forgotten and pers...
by Zaphod
Fri 17 Aug 2018, 01:19
Forum: Graphics and Games
Topic: Listbox Selecting
Replies: 8
Views: 3469

Re: Listbox Selecting

It may be that you have no buffering to the interrupts and they are coming too fast. That is to say the one you are looking for is overwritten by a later one before you got to processing the interrupt in your main program polling loop. You can speed up the main loop or look at some interrupt bufferi...
by Zaphod
Tue 14 Aug 2018, 13:15
Forum: Graphics and Games
Topic: Listbox Selecting
Replies: 8
Views: 3469

Re: Listbox Selecting

I think what you are missing is that the @wparam% contains information in the high word as well in Windows. When you click on the List box you will get notification codes in this word. So if you look at @wparam% >>16 you will see perhaps one of these. LBN_SELCANCEL = &3 LBN_SELCHANGE = &1 even if yo...
by Zaphod
Tue 14 Aug 2018, 03:08
Forum: Graphics and Games
Topic: Listbox Selecting
Replies: 8
Views: 3469

Re: Listbox Selecting

Shouldn't that be Click% MOD &10000 to get the low word? A control ID of 1 is normally reserved for the OK button in Windows, ID=2 for the Close or Cancel buttons. The control ID for the button will be different to that of the Listbox so can't you just use a CASE statement ON SYS Click%=@wparam% AND...