PDA

View Full Version : A few more questions..



oldpapa49
19-03-2009, 16:41
Ok, with some help I have started to make my menu up.. Just a simple window with buttons.

The button when click should open up a new window.. or repaint the old with new info. I'm thinking close window and open new.

Ok, here is what I like to know.. If I click the button, I want it to open this window for more selections. So far there are 4 choice on the main window, which will lead to sub choices. These will be up or down and the results sent serial (I'm not there yet).

Also, is there a trace command?
And can I put the result on the debug window.. Like when it ends it will say what my variables had .. Like mag = "yes"

I use to do this when I would test my functions and if they had what I expected.

Maybe a little bit of light here will help.

My job is repair and reverse engineering things that are basically non-repairable. In this case it deals with a Medical Specific monitors that is controlled via serial communication. I have decode all codes and can send via a program called RealTerm. I have a list of 15 main codes dealing with vertical adj, Horz adj, Pin Cushion etc.

I want to make this portable as you know and easy..

I'm basically stuck right now at when I click my box, how do I make it do it..
I want to see it in basic 1st before I make the next menu or control the serial.

I have looked at sample and have mod the ones to what I need. I have used Petr #include to perform the buttons (Thanks Petr).
I can put the so so program here if you like.. Just I have lines that are so so..

Wayne

oldpapa49
19-03-2009, 18:55
I have looked at Lionhearts008 code.. It has helped and the light is going from a lowly lit to a better to see you my dear brightness..

I'm still digging at it..

ErosOlmi
19-03-2009, 19:31
Wayne,

if you post your code, even if basic or incomplete, we can help more. I will be happy to review it and rewrite some part of it if you like.
Creating different windows is of course possible but it would be more code expensive because you have to write all callbacks. So at first it would be better to just create one window and handle data end events in controls. Consider you can have TAB controls, tree controls, listview, splitter bars, and even viewports. All thise controls let you manage different areas.

Some thinBasic UI examples are still using old GetMessage way to handle events. We are changing all those examples to callbacks usage so be sure to go into that direction.

When debugging UI script it is important to place breakpoints on the lines your need to check variables otherwise events can come at hundred per seconds and it would be impossible to debug. thinBasic debugger automatically shows all available variables in the function you are.

Ciao
Eros

oldpapa49
19-03-2009, 21:00
Here it is, Sort of.. Eros

There be 4 pop-ups with buttons to do various things, poss left right, up down to reflect adjustment to the monitor.

The pin-cushion routine will have 2 choice with adj.

And the serial routine.. Adj code is from 00 to 255. The functions selections will be 00 to 15 with 1 for save and one for reset. Those two are there and not assign as of yet.. I will do that 1st to see if I can talk to the monitor under test.

Wayne

Michael Clease
19-03-2009, 22:40
I had a look an perhaps this layout might make it easier to maintain.


update : add these to my version(main window) to make sure that all the windows are killed when the main window is closed



CASE %WM_DESTROY
DIALOG END hVertDlg
DIALOG END hHorzDlg
DIALOG END hPINCDlg
DIALOG END hVidADlg
DIALOG END hSaveDlg
DIALOG END hReseDlg

oldpapa49
20-03-2009, 00:34
TY Michael, I did insert the info at end (I hope that's where it goes)

Can any one tell me the equivalent to

gosub, goto

As far as I can tell, thinBasic program follows from top to bottom.. by the calls I think,
I like making my code into blocks and either a goto or gosub (sorry old stuff).

The Save and the Reset functions do not need a windowpopup.. they just need to send a code to the RS232 port.. in dec it is 64 and 65.. I would need to look up off my list.

Also the current month and date will be changed to selecting COM port 1 to 4. The rest is all fixed, 9600, 8, n, 1 and the other as a response window of the decimal value selected from the up/dn boxes or arrow keys.

Here is what I will be doing..

Lets say Vertical is selected, the popup will have a Size and Center choice,
Click Size and by pressing either arrows up or dn or a box up or down to increase or decrease size (value).

The code has to go at as decimal example : 04 (decimal Value)
Each time the button is hit or up or down press it will change value.
decimal value is from 000 to 255 and displays warning at low and upper end.

I know there is an echo back, to confirm the action did.. I wait for that.

Once you are satisfied by the screen display , they can tap SAVE to store the last info into the monitors eeprom and select the next option.
I have yet to figure on how to alter the factory settings or read what is stored in the eeprom..
There is no docs on this monitor and all info was obtain by random inputs from a term program.

I might put in a fake screen save which is a bunch of codes going to the RS232 with no save. And a wake which is only 4 codes. I figure to have that as to observe the min contrast and brightness when in screen save.

Wow.. I have work, but somehow I think its a repetitive code routine.

Wayne

Michael Clease
20-03-2009, 00:58
Wayne there is no GOTO keyword but GOSUB can be replaced with Function or Sub as little subroutines

rather then writing GOSUB mysubroutine you would just put mysubroutine() and program execution would return to the next line.

SUB mysubroutine()

' your code here

END SUB

oldpapa49
20-03-2009, 22:27
I thought I let ya know on the progress..

I know when I exit the program it reports the correct Comport for the RS232.
Michael, I have added the data and hope it is in the right place. Much easier for me to read.

Eros, I am using breaks, it helps me a great deal to where the program fails.. I can then look at my mistakes easier!

I am up'ing the program for review.. I just need to get the sub windows to have a purpose and get the rs232 to talk. Windows 1st, I will work on this at home.. This fun and challenging.

Wayne

oldpapa49
21-03-2009, 19:50
Ok, how can I show my data on the screen in real time.. I have located on the bottom of the main screen a variable called commdata (dword).
It pops in as default value and when I click my up or down button it does not update on the screen but the commdata does.

Petr Schreiber
21-03-2009, 19:55
Hi,

if you need to update text on some control in dialog, you can use something like:

CONTROL SET TEXT hDlg, %myLabelWithState, FORMAT$(commdata )


Petr

oldpapa49
21-03-2009, 20:09
That worked, now how do I move it to another location on my menu.. I up the latest file so u can see..

Thanks for the help btw

Wayne

Petr Schreiber
21-03-2009, 21:30
To change position of dialog control just use:

CONTROL SET LOC hDlg, %CtrlRes, newXPos, newYPos

Little hint - all this stuff is related to handling of User Interface, UI.
You can browse the help for ThinBasic modules/UI/Controls for example to see what is possible to do.

You can get to help file by pressing F1 in ThinAir.


Petr

oldpapa49
21-03-2009, 21:45
Thanks Petr, I have done that, and yes I did get it.. Thanks a lot!

I have found that using the arrows keys will not be an advantage at this point because they move around the menu box but the buttons work better.
I will now drop the pop up windows and add a few more buttons on the main. I think I will have better control of data then to open a popup and ad more buttons. I will drop the button size to add up to 13 selections. So I might as well group them or 2 rows..

Undecided..
But it is near the end and will add the RS232.

Wayne