Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 30 Sep 2014, 16:15
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
BaCon - Bash-based Basic-to-C converter/compiler
Post new topic   Reply to topic View previous topic :: View next topic
Page 23 of 36 [526 Posts]   Goto page: Previous 1, 2, 3, ..., 21, 22, 23, 24, 25, ..., 34, 35, 36 Next
Author Message
GatorDog


Joined: 12 Sep 2006
Posts: 136

PostPosted: Thu 30 Jun 2011, 15:59    Post subject:  

I guess I'm having an extended senior moment. I tried this, but of course it
didn't fly.
Code:
label_title = MARK("<span color=\"red\">Color me red</span>",  50, 30)
ATTACH(mainwin, label_title, 30, 5)
Just printed the literal <span color=\"red\">Color me red</span> Question
Back to top
View user's profile Send private message 
L18L

Joined: 19 Jun 2010
Posts: 2507
Location: Moved from Hosla to www.eussenheim.de

PostPosted: Tue 05 Jul 2011, 16:00    Post subject: OT
Subject description: yad
 

Off Topic but this flies Very Happy
Code:
# yad --text="<span color=\"red\">Color me red</span>"


More on colors in yad see http://www.murga-linux.com/puppy/viewtopic.php?t=69312&start=16 Embarassed
color_me_red.png
 Description   
 Filesize   3.61 KB
 Viewed   883 Time(s)

color_me_red.png

Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5032
Location: Arizona, U.S.A.

PostPosted: Tue 20 Sep 2011, 20:51    Post subject:  

Is there a way to change blank line spacing in HUG`s List and Combo Boxes?

A medium length list becomes really long, there must be a way to set it...
Back to top
View user's profile Send private message 
GatorDog


Joined: 12 Sep 2006
Posts: 136

PostPosted: Tue 20 Sep 2011, 21:14    Post subject:  

sunburnt,
There may be a way to do it with "Import the GTK functions". (above my paygrade).
For a LIST widget, you can use FONT(List_, " 10") to set the font size.
However the line spacing still has same space to text proportions, but you
can get more (or less) lines in the same size LIST widget.

FONT works for a COMBO widget also, but not as you'd probably expect Wink

gDog
Back to top
View user's profile Send private message 
GatorDog


Joined: 12 Sep 2006
Posts: 136

PostPosted: Tue 20 Sep 2011, 21:16    Post subject:  

forum server hiccup / posted twice.
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5032
Location: Arizona, U.S.A.

PostPosted: Thu 22 Sep 2011, 05:19    Post subject:  

Thanks GatorDog, I haven`t tried your suggestion yet, dumped the combo for a list.
It`s interesting how the combo boxes in both HUG and gtkDialog kinda suck.
But they are both GTK, it`s also interesting how much different they are.

I hate pull down menus and combos, but are very useful for seldom needed things.

### Q... Is there a DirDialog to match the FileDialog? I didn`t see one.
................ The FileDialog won`t return just a path, of course.

I`ll probably just end up using EXEC$ with Xdialog`s dselect as usual. So sad...
Back to top
View user's profile Send private message 
GatorDog


Joined: 12 Sep 2006
Posts: 136

PostPosted: Thu 22 Sep 2011, 12:01    Post subject:  

Quote:
### Q... Is there a DirDialog to match the FileDialog? I didn`t see one.
................ The FileDialog won`t return just a path, of course.
Well, actually it will Very Happy
Code:
INCLUDE "/usr/share/BaCon/hug_imports.bac"
INIT

CONST Mainwin_width = 200
CONST Mainwin_height = 200
CONST Mainwin_border = 5
CONST Btn_height = 25
CONST Btn_width = 125

GLOBAL Foldername$ TYPE STRING

' =====================================================
'          SETUP FILEDIALOG FOR FOLDER/DIRECTORY
' =====================================================
' ------------------
SUB OPEN_FILEDIALOG
' ------------------
   SHOW(Get_folder_)
END SUB

' ------------------
SUB GET_FOLDERNAME(int Foldername_handle_, int Button_)
' ------------------
   'On exit, Foldername$ = the folder/directory
   HIDE(Foldername_handle_)
   IF Button_ = GTK_RESPONSE_ACCEPT THEN
      Foldername$ = GRAB$(Foldername_handle_)
   ELSE
      Foldername$ = ""
   END IF

' For demo
PRINT Foldername$
' -------

END SUB
' ------------------

' ------------------
SUB MAKE_GUI
' ------------------
   Mainwin_ = WINDOW("Get Folder Demo", Mainwin_width, Mainwin_height)

   Get_folder_ = FILEDIALOG("Select Folder/Directory", "gtk-ok", 300, 300, 2)

   Browse_btn_ = BUTTON("Browse", Btn_width, Btn_height)
   ATTACH(Mainwin_, Browse_btn_, 5, 5)
   CALLBACK(Browse_btn_, OPEN_FILEDIALOG)
   CALLBACK(Get_folder_, GET_FOLDERNAME)
END SUB
' =====================================================
'                   END SETUP FILEDIALOG
' =====================================================

' ******************
LABEL MAIN
' ******************

MAKE_GUI

DISPLAY

rod
folder.png
 Description   
 Filesize   30.98 KB
 Viewed   597 Time(s)

folder.png

Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5032
Location: Arizona, U.S.A.

PostPosted: Thu 22 Sep 2011, 12:46    Post subject:  

Ahhh yes... I seem to recall looking at the Message Dialog`s options.
I should have guessed, or better yet used your reference guide...

Now to see if "configure --prepath ......." creates the final dir. ( I think so...).

Many thanks GatorDog, this is coming close to being functional. Terry
Back to top
View user's profile Send private message 
GatorDog


Joined: 12 Sep 2006
Posts: 136

PostPosted: Thu 22 Sep 2011, 18:07    Post subject:  

Quote:
Now to see if "configure --prepath ......." creates the final dir. ( I think so...).

Don't know what you're trying to do, but Bacon has MAKEDIR Wink

rod
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5032
Location: Arizona, U.S.A.

PostPosted: Thu 22 Sep 2011, 20:04    Post subject:  

Yep... Just need to see if I need to use it !

Another code Q...
Code:
btnDnldP_ = BUTTON("Download Path",120,25)
ATTACH(tab0_,btnDnldP_,5,tabH-120)
CALLBACKX(btnDnldP_,showDLG,0)

SUB showDLG(int btnN)
   SHOW(DLG_)
PRINT btnN
PRINT btnDnldP_
END SUB

### "PRINT btnN" doesn`t show "0", it shows the same as "PRINT btnDnldP" !!!
The BaCon docs seem pretty clear on how to use CALLBACKX ...

# I`m trying to reuse the same FileDialog with different buttons.
....... Each button gets it`s own EntryBox filled from the FileDialog.
....... Should only need to declare/create one FileDialog, right?
# It`d be nice to be able to control the FileDialog type and WinTitle.

# Additional Q... Way to get a return from a Bacon exec file? Like a function?
Back to top
View user's profile Send private message 
GatorDog


Joined: 12 Sep 2006
Posts: 136

PostPosted: Thu 22 Sep 2011, 21:32    Post subject:  

sunburnt wrote:
Another code Q...
The BaCon docs seem pretty clear on how to use CALLBACKX ...

Code:
CALLBACKX(widget, function, value)

Type: directive

Defines a self-defined <function> where HUG should jump to when an event for <widget> occurs,
and pass <value> to that function. The arguments in the callback function should catch this value.

Example:

INCLUDE "hug.bac"

SUB demo(NUMBER widget, NUMBER value)
    PRINT value
END SUB

Modify your sub definition-
Quote:
SUB showDLG(NUMBER Handle_, int btnN)

Quote:
# I`m trying to reuse the same FileDialog with different buttons.
....... Each button gets it`s own EntryBox filled from the FileDialog.
....... Should only need to declare/create one FileDialog, right?
Probably one, for each type used.

Quote:
# It`d be nice to be able to control the FileDialog type and WinTitle.

Code:
TEXT(widget, "text")
Depending on the widget, sets the text. The current behavior is shown in the table below.
WINDOW Sets the text in the title bar

Quote:
# Additional Q... Way to get a return from a Bacon exec file? Like a function?

Code:
EXEC$(command$ [, stdin$])

Type: function

Executes an operating system command and returns the result to the BaCon program.
The exit status of the executed command itself is stored in the reserved variable RETVAL.
Optionally a second argument may be used to feed to STDIN. See SYSTEM to plainly execute a
system command. Example:

result$ = EXEC$("ls -l")
result$ = EXEC$("bc", CONCAT$("123*456", NL$, "quit"))


Or, if you mean for a Bacon program to return a value on STDIN, simply have it PRINT the
value before it exits.

rod
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5032
Location: Arizona, U.S.A.

PostPosted: Fri 23 Sep 2011, 03:58    Post subject:  

Thanks again GatorDog; I`m getting the feel of Bacon, it`s different than QBasic.

Here`s something I was talking about, and you helped me write it.
FFdialog ... ( FileFolder dialog )
It`s an exec. of the FileDialog, it works in Bacon-HUG and in the Bash shell !
Returns the /path/[file], and it also sets the proper WinTitle.

# Just one problem: In the shell it works fine, but...
In Bacon, it leaves a control character at the end of it`s return, probably a LF.
I suppose I`ll have to filter it out in the Bacon program that calls it ( dang! ).

Compile it and make an app. to run it with a label to show the return.
To exec. it:
Code:
FFdialog [ 0 - 3 ]

Take your time... No big rush that you mess with this... Terry
FFdialog.bac.gz
Description 
gz

 Download 
Filename  FFdialog.bac.gz 
Filesize  477 Bytes 
Downloaded  214 Time(s) 
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Fri 23 Sep 2011, 06:45    Post subject:  

Dear sunburnt,

Try this out:

Code:
IF INSTR(ARGUMENT$, " ") = 0 THEN
   Style = 0
ELSE
   Style = VAL(CHOP$(RIGHT$(ARGUMENT$, 1)))
END IF


CHOP$ removes exteraneous garbage....and it works.

With kind regards,
vovchik
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5032
Location: Arizona, U.S.A.

PostPosted: Fri 23 Sep 2011, 12:00    Post subject:  

vovchik; Yes, I`d just hoped that the LF could be removed in FFdialog.
Further checks proved it can`t be, so it must occur when passed to the caller.
Fixed in the Bacon calling program, not in FFdialog.
Code:
FF$ = CHOP$(EXEC$(Title$, "2"))

Strange how the Bash shell doesn`t get the LF but Bacon does...
Back to top
View user's profile Send private message 
GatorDog


Joined: 12 Sep 2006
Posts: 136

PostPosted: Fri 23 Sep 2011, 13:48    Post subject:  

Quote:
...Yes, I`d just hoped that the LF could be removed in FFdialog.


Ah yes, sahib, your wish is my command Twisted Evil

Quote:
PRINT
...
Prints a numeric value, text, variable or result from expression.
A semicolon at the end of the line prevents printing a newline.



Lookin' good
Gatordog
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 23 of 36 [526 Posts]   Goto page: Previous 1, 2, 3, ..., 21, 22, 23, 24, 25, ..., 34, 35, 36 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

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
[ Time: 0.0981s ][ Queries: 12 (0.0089s) ][ GZIP on ]