Студопедия

Главная страница Случайная страница

КАТЕГОРИИ:

АвтомобилиАстрономияБиологияГеографияДом и садДругие языкиДругоеИнформатикаИсторияКультураЛитератураЛогикаМатематикаМедицинаМеталлургияМеханикаОбразованиеОхрана трудаПедагогикаПолитикаПравоПсихологияРелигияРиторикаСоциологияСпортСтроительствоТехнологияТуризмФизикаФилософияФинансыХимияЧерчениеЭкологияЭкономикаЭлектроника






A Typical GUI Form With a Few More Bells and Whistles






This example demonstrates how to add a rectangular button that resizes to fit the button text, rectangular areas for text input, and right justified text labels:

text$ = " " bigtext$ = " " number = 0listselection$ = " " gr.open 255, 248, 248, 248gr.color 255, 0, 0, 0, 0gr.orientation 1 gr.text.align 3gr.text.draw t1, 75, 50, " Text: " gr.text.align 1gr.text.draw f1, 100, 50, " " gr.rect l1, 95, 27, 300, 65 gr.text.align 3gr.text.draw t2, 75, 100, " Big Text: " gr.text.align 1gr.text.draw f2, 100, 100, " " gr.rect l2, 95, 77, 300, 115 gr.text.align 3gr.text.draw t3, 75, 150, " Number: " gr.text.align 1gr.text.draw f3, 100, 150, " " gr.rect l3, 95, 127, 300, 165 gr.text.align 3gr.text.draw t4, 75, 200, " List Select: " gr.text.align 1gr.text.draw f4, 100, 200, " " gr.rect l4, 95, 177, 300, 215 gr.text.bold 1btn1$ = " SUBMIT" gr.color 255, 0, 0, 0, 1gr.get.textbounds btn1$, l, t, r, bgr.rect btn1, l+110-10, t+270-10, r+110+10, b+270+10 % match b1 pos (110)gr.text.bold 0gr.color 255, 255, 255, 255, 0gr.text.draw b1, 110, 270, btn1$gr.color 255, 0, 0, 0, 0 gr.render getText: do gr.touch touched, x, y until touched gr.front 0 if y < 75 input " Text: ", text$, text$ gr.modify f1, " text", text$ elseif y < 125 text.input bigtext$, bigtext$ gr.modify f2, " text", bigtext$ elseif y < 175 input " Number: ", number, number gr.modify f3, " text", replace$(str$(number), ".0", " ") elseif y < 225 array.delete list$[] array.load list$[], " Red", " Green", " Blue" select selecteditem, list$[], " Favorite Color: " listselection$ = list$[selecteditem] gr.modify f4, " text", listselection$ elseif y > 250 & y < 300 gr.front 0 print " Submitted: \n\n"; text$, bigtext$, number, listselection$ pause 2000 endif gr.front 1 gr.rendergoto getTextonError: cls end


---Recipe Database #3 (This Time With a Graphic GUI)

Transferrting Data Via Network Sockets

Computing devices connected together on the same wired or wireless network can transfer data and files directly to one another via network (TCP and UDP) " socket" connections.

Network applications are typically made up of two or more separate programs, each running on different computers. Any computer connected to a network or to the Internet is assigned a specific " IP address", notated in the format xxx.xxx.xxx.xxx. The numbers are different for every machine on a network, but most computers connected to home routers are normally in the local IP range " 192.168.xxx.xxx". You can obtain the IP address of your local computer with the following RFO Basic code:

(to be completed...)

Ports

When writing a network application, you must choose a specific port number through which data is to be transferred. Potential ports range from 0 to 65535, but many of those numbers are reserved for specific types of applications (email programs use port 110, web servers use port 80 by default, etc.). To avoid conflicting with other established network applications, it's best to choose a port number between 49152 and 65535 for small scripts. A list of reserved port numbers is available here.


Поделиться с друзьями:

mylektsii.su - Мои Лекции - 2015-2024 год. (0.007 сек.)Все материалы представленные на сайте исключительно с целью ознакомления читателями и не преследуют коммерческих целей или нарушение авторских прав Пожаловаться на материал