The time now is Mon 09 Dec 2019, 11:15
All times are UTC - 4 |
Author |
Message |
vovchik

Joined: 23 Oct 2006 Posts: 1512 Location: Ukraine
|
Posted: Thu 28 Feb 2013, 12:38 Post subject:
|
|
Dear Terry,
Glad to see youa re so busy There is a link to UXP binaries on the forum:
http://208.109.22.214/puppy/viewtopic.php?t=77793&sid=9977951c618ccb16cc4e27cb706abdd5
With kind regards,
vovchik
|
Back to top
|
|
 |
e_mattis

Joined: 20 Dec 2012 Posts: 114 Location: Williamston, SC
|
Posted: Thu 28 Feb 2013, 21:35 Post subject:
|
|
Hey guys,
@ L18L
yea, isn't it funny how such a small mistake can make you look like such a big dummy ! I went back and sure enough- no line after the end. I put one there and got a good run through. Thanks m8!
@ vovchik
I see what you mean. Tried the hug_imports just for 'grins & giggles' to see what would happen. what a mess! LOL Thanks for the fore-warning!
@ everyone
Now I have more questions....
I need to incorporate a text-area on my window. Also, I will have a listbox to list the 'records' within a file (i.e. lines of data contained within).
I've looked through the docs I have, but do not see any indication of a text area command. I'm sure it is probably something i am overlooking - like multiline or something - so I ask, is there a means of producing multi-lined entry?
As far as the second issue, I have the listbox set up. Question is what would be the best method of inserting data obtained from the read-in of a file? Can I simply create an array and print it to the listbox?
You guys are the best! I have gained a lot of insight from you and appreciate it more than I can express.
Thanks!
E
.
|
Back to top
|
|
 |
sunburnt

Joined: 08 Jun 2005 Posts: 5087 Location: Arizona, U.S.A.
|
Posted: Thu 28 Feb 2013, 22:47 Post subject:
|
|
If you`re using OPEN to read the file then it`s already in an array, correct?
If your using Txt$ = EXEC$(CONCAT$("cat ", $PathFile)) as I suggested then:
Code: | SPLIT Txt$ BY NL$ TO File$ Size fileSz |
Now the file`s contents is in the array $File$[]
The MARK is Bacon`s "Label", it only shows text and can do multiple lines.
|
Back to top
|
|
 |
e_mattis

Joined: 20 Dec 2012 Posts: 114 Location: Williamston, SC
|
Posted: Thu 28 Feb 2013, 23:48 Post subject:
|
|
Thanks sunburnt,
Yea, the info is already in an array, just not sure how to print it in the list box. assuming the 'MARK' attribute will do that?
Also, the multi lined area is not the listbox. It will actually be a 'notes' area - for entering your personal notations. As an ENTRY box, i would assume there would be some sort of word-wrap or multi-line setting to use in order to accomplish this. Haven't found the code yet though.
Thanks!
E
[update] 022813 23:32 est
Looks like i figured out the print to listbox (finally ):
TEXT(listbox,variable)
Still working on how to make a multi-line ENTRY box, so any help will be appreciated
.
|
Back to top
|
|
 |
vovchik

Joined: 23 Oct 2006 Posts: 1512 Location: Ukraine
|
Posted: Fri 01 Mar 2013, 04:41 Post subject:
|
|
Dear e_mattis,
This may or may not be what you are after, but HUG's EDIT box allows for multiple lines:
Code: |
EDIT(xsize, ysize)
Type: directive
Defines a multiline text widget with a width of <xsize> and a height of <ysize>.
Returns the ID of the created text widget.
|
With kind regards,
vovchik
PS. For reading in text files, which I do often, I use my own hand-rolled CAT command:
Code: |
' --------------------
FUNCTION CAT(STRING FILENAME$)
' --------------------
LOCAL fileline$, txt$ TYPE STRING
IF FILEEXISTS(FILENAME$) THEN
OPEN FILENAME$ FOR READING AS catfile
WHILE NOT(ENDFILE(catfile)) DO
READLN fileline$ FROM catfile
txt$ = CONCAT$(txt$, fileline$, NL$)
WEND
CLOSE FILE catfile
END IF
RETURN CHOP$(txt$)
END FUNCTION
x$ = CAT("/etc/profile")
PRINT x$
|
And, as sunburnt has said, if you use NL$ as your SPLIT delimiter, every separate line will be an array element. If you don't want to use arrays, you can always use my little GETWORD$ function:
Code: |
' --------------
FUNCTION GETWORD$(STRING mystring$, NUMBER word_number, STRING delimiter$)
' --------------
LOCAL i, mypos, n TYPE NUMBER
LOCAL string_temp$ TYPE STRING
i = 0
mypos = 0
n = 1
string_temp$ = ""
mystring$ = CONCAT$(mystring$, delimiter$)
REPEAT
mypos = INSTR(mystring$, delimiter$, n)
INCR i
IF i = word_number THEN
string_temp$ = MID$(mystring$, n, (mypos - n))
END IF
n = mypos + 1
UNTIL mypos IS FALSE
RETURN string_temp$
END FUNCTION
x$ = CAT("/etc/profile")
' grab first line
y$ = GETWORD$(x$, 1, NL$)
PRINT y$
|
|
Back to top
|
|
 |
vovchik

Joined: 23 Oct 2006 Posts: 1512 Location: Ukraine
|
Posted: Fri 01 Mar 2013, 06:22 Post subject:
Peg Solitaire - BaCon version |
|
Hi guys,
This is a little game I programmed in Bacon durng the summer but revised it today to take into account the stricter type casting in newer BaCon versions. The excercise was interesting, at least to me, for a number of reasons:
The graphics are all internal to the source - they are generated internally and not loaded from disk.
The program shows how to change mouse cursors and how to create a unique taskbar icon.
My implementation, after some long and hard thought, avoids any real movement of objects. They are simply hidden or shown, and I keep track of thier status.
The rsvg lib is put to good use, and gtk and gkd imports are used because native HUG did not have them.
The program demostrates how to REGISTER new widgets in HUG.
I compiled the binary in lucid (using Bacon beta 1.30 and hug 0.83) and then UPX'd it, so it is not large (23k).
The compile line was:
Code: |
bacon -o -s -o -Os -o -fdata-sections -o -ffunction-sections -o -Wl,--gc-sections psol-1
|
Have fun....
With kind regards,
vovchik
PS. The game is winnable, but it ain't easy. Press the Help button for instructions on how to play. The archive contains a compiled binary and the source.
Description |
|
Filesize |
20.92 KB |
Viewed |
795 Time(s) |

|
Description |
|

Download |
Filename |
psol1.tar.gz |
Filesize |
27.72 KB |
Downloaded |
337 Time(s) |
|
Back to top
|
|
 |
e_mattis

Joined: 20 Dec 2012 Posts: 114 Location: Williamston, SC
|
Posted: Fri 01 Mar 2013, 12:02 Post subject:
|
|
@ Vovchik
That was exactly what I have been searching for! Never thought it would be listed as 'edit'. Thanks so much!
Also like the 'getword function'. may make it easier to accomplish what I will need. I will give it a shot!
Nice game, too! Haven't gotten to play it much yet, no wins but it may just replace my old "time-killer" solitaire card game at this rate!
You, my friend, are awsome!
@everyone
I really appreciate all your inputs. It is important to me that I learn how to make a 'program' for Puppy as I intend for this OS to be my goto in the future. Thank you so much!
Thanks!
E
PS: So you guys will get an idea, here is a screen of what I'm working on.
Description |
GUI for manufacturer database |
Filesize |
18.83 KB |
Viewed |
768 Time(s) |

|
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 3450 Location: www.eussenheim.de/
|
Posted: Fri 01 Mar 2013, 13:48 Post subject:
|
|
e_mattis wrote: | PS: So you guys will get an idea, here is a screen of what I'm working on. | No country, no internationalization.
Globalisation disabled.
|
Back to top
|
|
 |
sunburnt

Joined: 08 Jun 2005 Posts: 5087 Location: Arizona, U.S.A.
|
Posted: Fri 01 Mar 2013, 13:58 Post subject:
|
|
The commands are:
Code: | TEXT for entering or changing text in a widget.
GRAB$ for getting text from a widget. |
This transfers text from widget to widget by widget`s index ( List or Combo ):
Code: | TEXT(widget, GET(index)) |
Transfer text from widget to widget by widget`s text ( Button, Mark, List, Combo, etc.):
Code: | TEXT(widget, GRAB$(widget)) |
It sounded like you were looking for a Label widget, sorry...
Looking at your GUI, it looks like it could be for both display and entry.
To enter or edit an item use a ENTRY, to display text only use a MARK.
|
Back to top
|
|
 |
e_mattis

Joined: 20 Dec 2012 Posts: 114 Location: Williamston, SC
|
Posted: Fri 01 Mar 2013, 22:20 Post subject:
|
|
@L18L
Yea, sorry bud, haven't gotten to putting in the internationalization yet. Gotta get my coding right first for the basis, then I can get 'fancy'
@sunburnt
Thanks m8, that should help make my coding a little prettier when I feel comfortable that I understand it properly. And you are correct, it will be used to both enter and view information. Figure editing can be done by changing displayed info and then saving.
Thanks you guys - all the help has made it possible for me to actually write stuff! I know I will need your inputs as I trudge through on this journey. It is great to know I can count on some assistance along the way!
Thanks!
E
.
|
Back to top
|
|
 |
e_mattis

Joined: 20 Dec 2012 Posts: 114 Location: Williamston, SC
|
Posted: Sat 02 Mar 2013, 23:44 Post subject:
Subject description: opening web page via variable |
|
Hey guys,
Well, i'm back again I have run into a situation I can't resolve with my limited knowledge.
I have an ENTRY box t input a web address. When the entry is reviewed, if desired, I have a button to launch the web browser to the address listed in the ENTRY box.
Here is how I have it set up at the present. it opens the browser but instead of the web page I get the 'FILE:///' index:
Code: |
webz$=GRAB$(webaddy)
IF LEFT$(webz$,7) = "http://" THEN doit
webz$=CONCAT$("http://",webz$)
END IF
LABEL doit
SYSTEM "exec defaultbrowser webz$ &"
|
would it work better to just use the GRAB$ in the SYSTEM cmd? If the http:// is not included in webaddy, would this disrupt the flow?
Thanks!
E
.
|
Back to top
|
|
 |
vovchik

Joined: 23 Oct 2006 Posts: 1512 Location: Ukraine
|
Posted: Sun 03 Mar 2013, 04:30 Post subject:
|
|
Dear e_mattis,
Just a little mod to your code:
Code: |
SUB LAUNCH_BROWSER(STRING my_url$)
SYSTEM CONCAT$("exec defaultbrowser ", my_url$, " &")
END SUB
webz$=GRAB$(webaddy)
IF LEFT$(webz$, 7) = "http://" AND LEN(CHOP$(webz)) > 7 THEN
LAUNCH_BROWSER(webz$)
ELIF LEN(CHOP$(webz$)) > 1 THEN
webz$ = CONCAT$("http://", webz$)
LAUNCH_BROWSER(webz$)
ELSE
PRINT "Bad URL. Try again."
END IF
|
I am assuming you want to make sure that you include the "http://" before you pass the URL to the browser, so you want a properly formatted URL. The tests for validity above are, of course, not good or exhaustive. You could "ping" the site to ensure that it exists first - or use BaCon's networking function - to see that it is responding before launching your browser.
With kind regards,
vovchik
|
Back to top
|
|
 |
e_mattis

Joined: 20 Dec 2012 Posts: 114 Location: Williamston, SC
|
Posted: Sun 03 Mar 2013, 18:34 Post subject:
|
|
Thanks Vovchik!
That was exactly what I needed You are AWSOME!
Now all that is left is to construct the 'remove record', 'edit record', and add internationalization.
Almost there!
Thanks!
E
.
|
Back to top
|
|
 |
e_mattis

Joined: 20 Dec 2012 Posts: 114 Location: Williamston, SC
|
Posted: Sun 03 Mar 2013, 23:48 Post subject:
|
|
ok, so i've been working on this like the past 5 hours....
I have created the SUB to remove the unwanted record. The flow I am following is this:
clear gui workarea
find the record selected in list
confirm removal of record
find record in database file
remove record from database file and list
tidy up
I am at the 'confirm removal of record' task. Here is the code I have thus far for this section:
Code: |
killmsg$=CONCAT$("You are about to delete ",kilme$," !")
kilme_dlg= MSGDIALOG(killmsg$,350,110,1,1)
SHOW(kilme_dlg)
CALLBACK(kilme_dlg,killme_btn)
PRINT kmv
|
I have the 'killme_btn' FUNCTION outside the above SUB.
Code: |
FUNCTION killme_btn( NUMBER value)
HIDE (kilme_dlg)
IF value = GTK_RESPONSE_OK THEN
kmv = 0
ELIF value = GTK_REPONSE_DELETE_EVENT THEN
kmv=1
END IF
RETURN kmv
END FUNCTION
|
My problem is two-fold; 1. KMV shows '0' as soon as the selection is made in the listbox and does not change after the MSGDIALOG FUCTION (value kmv not being returned?) and 2. - this is most likely why there is a problem #1 - I cannot figure out the process of using buttons with MSGDIALOG (ie how they react/respond or how to manipulate the result of the button being pushed).
I have also tried CALLBACKX(kilme_dlg,killme_btn,dmv) which gave compile errors because dmv is not assigned yet (?) - even when I set it to 0 (dmv=0) beforehand.
In the Winbloze basic i'm familiar with, the code would be : Code: | CONFIRM"Delete this file?";a$
LOWERCASE$(a$)
IF a$ = "y" OR a$ = 'yes" THEN dmv=0:GOTO next
dmv=1
[next]
|
this would send kmv to the PRINT line as '0' if OK_BTN was pushed or as '1' if the window were closed without the button being pushed.
I would prefer that the yes/no buttons be used in the dialog and want to set it up so that only the 'yes' button would go through to find the selected file in the database.
I have consulted these references for help:
http://www.basic-converter.org/documentation.html
http://www.basic-converter.org/hugdoc.html
http://basic-converter.proboards.com
I still cannot seem to put it all together Can someone, anyone, please explain how I might get this to work and how to use the MSGDIALOG buttons? All help is greatly appreciated!
Thanks!
E
.
Last edited by e_mattis on Mon 04 Mar 2013, 00:23; edited 1 time in total
|
Back to top
|
|
 |
Mobeus

Joined: 26 Aug 2010 Posts: 94
|
Posted: Mon 04 Mar 2013, 00:18 Post subject:
|
|
E
Could this be the problem? From http://www.basic-converter.org/hugdoc.html#MSGDIALOG
Quote: | The dialog can be connected to a callback function which should have two arguments, the first for the dialog and the second for the button.
SUB HandleError(NUMBER dialog, int button) | Your function def is Code: | FUNCTION killme_btn( NUMBER value) |
Regards,
Mobeus
_________________ /root for the home team
|
Back to top
|
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|