Source language: Translate to:

Insert html tags

Post your suggestions for future versions of NeoBook

Moderator: Neosoft Support

Insert html tags

Postby datadon » Thu Apr 19, 2007 12:42 pm

There are ways to do this code wise so I am probably breaking a rule by requesting something that can be done that way. It just is painful.

Html editors allow you to select text and then it applies predetermined tags to both ends of the selected text. I know I can select text using the GetInfo object action, and put the tags on both ends, I can get the cursorposition and then get the length of the string, and do things that way, but it requires a lot of code and effort. (maybe there is an easy way I just can't think of it)

So I am requesting an action similar to the get selected text that would allow me to replace my selected and then modifed string in the same place that the text was selected from, and replace only the items higlighted.

I hope some other lazy person would want this to. :?
Don

'If you want to get a brontosaurus from 'a' to 'b' then you ride the dinosaur - you don't carry it!'
User avatar
datadon
 
Posts: 389
Joined: Sun Apr 03, 2005 7:55 pm
Location: Lorena Texas

Postby Gaev » Thu Apr 19, 2007 1:43 pm

datadon:

How about if there was a custom Function that you could Call from anywhere in any project ? ... something like ...
Code: Select all
Call "gkWrapSelection" "objectName" "Prefix text" "Suffix Text"

So, for example you could then just place a command like this in your pub ...
Call "gkWrapSelection" "TextEntry6" "!<image>" "!</image>"
User avatar
Gaev
 
Posts: 3717
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby datadon » Thu Apr 19, 2007 10:05 pm

Well that would work, but I don't think object name is enough of a limiter. It would need to be the selected text. If I wanted to put <b>[selectedtext]</b>, I don't know how to get in back into the selected text. But yes a function would work if it would do that.

If it doesn't work on selected text it would not be of value.

Thanks Gaev, maybe you have an idea I am not seeing.

Don
Don

'If you want to get a brontosaurus from 'a' to 'b' then you ride the dinosaur - you don't carry it!'
User avatar
datadon
 
Posts: 389
Joined: Sun Apr 03, 2005 7:55 pm
Location: Lorena Texas

Postby HPW » Thu Apr 19, 2007 10:20 pm

A similar problem was solved here with regexp:

http://www.neosoftware.com/forum/viewtopic.php?t=15021
Hans-Peter
User avatar
HPW
 
Posts: 2510
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany

Postby Gaev » Fri Apr 20, 2007 5:28 am

Don:
Well that would work, but I don't think object name is enough of a limiter. It would need to be the selected text.

Yes, the function would ...

a) extract the "selected text" from the specified TextEntry object to a temp [variable] ; if none, no further action !!

b) wrap the "prefix and suffix text" around this temp [variable]

c) replace the "selected text" with the contents of this temp [variable]


... as the function name (gkWrapSelection) implies ... it would ONLY wrap stuff around any selected text.

If it doesn't work on selected text it would not be of value.

It would ONLY work on selected text.

If I wanted to put <b>[selectedtext]</b>, I don't know how to get in back into the selected text. But yes a function would work if it would do that.
...maybe you have an idea I am not seeing.

You can use GetObjectInfo with SelectedText to extract the "selected text".

And GetObjectInfo with CursorPosition to identify the relative location of the "selected text".

Then, you could use ...

- either the combination of FocusObject and SendKeys

- or just replace the contents of the Variable (to store Text Entry contents) with the new content e.g.

aaaattttzzzz would become aaaaPPPPttttSSSSzzzz

where tttt is the selected text, PPPP and SSSS are the desired Prefix and Suffix text ... and aaaa/zzzz are the unselected text.

This second method would be more robust (I only use SendKeys as a last resort) ... but might require the function to specvify one more parameter ... in case some people use different "Object" and "Variable (to store Text Entry contents)" names e.g. "TextEntry16" and "[CustomerName]"

If you want, I can build such a function for you ... just send me an email.
User avatar
Gaev
 
Posts: 3717
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

I would love to see this function

Postby arkzero » Fri Oct 09, 2009 8:05 am

hi Gaev :D

don't know if your around as this thread is quite old now but,
I would love to see this function!
could you possibly build and show me this?

Im trying to get BBcode tags wrapped around selected text for a small
freeware app i would like to make for designing forum posts and viewing them without being on a forum you wish to post on.

i would like it to create posts allowing Links,Imagies and all the rest of the
typical Posting features of a Php BB - for a start.

so if you can help that would be amazing! :shock:

best Regards
Ark
arkzero
 
Posts: 22
Joined: Sat Oct 03, 2009 11:19 am

Postby domino » Wed Nov 04, 2009 7:17 am

To take this suggestion (with which I agree) one step further.

It would really be useful to be able to export suitable code as .php snippets.

eg... math - some file functions - DBPro queries as php/MySQL formatted code etc....

The strength of NeoBook has always been in it's ability to develop apps without having to learn often complex programming languages - in an increasingly Web dominated environment such a facility (I'm guessing) would be a real boon to many users.

My customers are increasingly asking for this stuff to complement or even in lieu of Windows pubs.

Just thinking aloud for now... but were such a facility or plugin available I would definitely be prepared to pay a premium for it.

Cheers
Dave
User avatar
domino
 
Posts: 275
Joined: Sat Apr 02, 2005 7:11 am
Location: Notts UK

Postby Neosoft Support » Wed Nov 04, 2009 11:05 am

Below is some sample code that will add bold tags to the selected text. It can be easily modified to insert other types of tags.

Code: Select all
GetObjectInfo "TextEntry1" "SelectedText" "[SelText]"
GetObjectInfo "TextEntry1" "CursorPosition" "[CurPos]"
If "[SelText]" ">" ""
  StrLen "[SelText]" "[SelLen]"
  StrIns "</b>" "[TextEntry1]" "[CurPos]" "[TextEntry1]"
  StrIns "<b>" "[TextEntry1]" "[CurPos]-[SelLen]" "[TextEntry1]"
Else
  AlertBox "Error" "No text is selected."
EndIf


It would really be useful to be able to export suitable code as .php snippets.


How would this work exactly?
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby domino » Wed Nov 04, 2009 11:22 am

Re the .php thread creep...

How would this work exactly?


I`ll think it through a bit more and post in due course....

Cheers
Dave
User avatar
domino
 
Posts: 275
Joined: Sat Apr 02, 2005 7:11 am
Location: Notts UK

Postby Horst Helfen » Thu Nov 05, 2009 7:36 am

The easiest way for me is to cut the hihglihgted text, write the opening tag, paste the cut text and write the end tag.
I quickly set up a little pub that basically provides this ability.
You have a text entry to put some code in. Select some text, choose the kind of tag you want and press the button.


Code: Select all
NBW Publication Source File
(C)1993-2008 NeoSoft Corp.
Title=Untitled NeoBook Publication
Language=US
NeoBookVer=5,60
ScreenColors=16777216
ScreenWidth=640
ScreenHeight=480
BkndColor=0
ScreenAutoSize=Yes
LinkColor=16711680
WindowStyle=0
WindowOrder=0
WindowPos=0
WindowProps=31
BiDiMode=0
UseUpdateTimer=Yes
ReturnTime=60
ShapeTransColor=536870912
CompileType=0
MediaType=0
FilesIncluded=1
FontsIncluded=2
CopyExternalFiles=No
SetupMedia=3
SetupInstDir=C:\MyProgram
SetupTitle=Setup
SetupColors=16711680|0|65535
Variables=[ListBox1]¶[TextEntry3]¶
VersionMajor=1
VersionMinor=0
VersionRelease=0
VersionBuild=0
CustomFontName=Arial
CustomFontSize=9
CustomFontStyle=0
CustomCharset=1
CacheSize=30
ExtractOp=132
L_OK=OK
L_CANCEL=Cancel
L_YES=Yes
L_NO=No
L_CLOSE=Close
L_ERRORTITLE=Error
L_FINDTITLE=Find
L_FINDPROMPT=Find &What
L_FINDFIRST=&Find First
L_FINDNEXT=Find &Next
L_FINDERROR=Search text not found.
L_PWORDTITLE=Password required
L_PWORDMSG=Before continuing, you must first|enter the correct password.
L_PWORDPROMPT=&Password:
L_PWORDERROR=That's not the right password!
L_MEDIAERROR=In order to play this type of file you must install|the appropriate multimedia hardware and/or|software.
L_INTERNETERROR=Unable to locate Internet Browser software.
L_ABORTFUNCTION=Do you want to cancel this function?
L_EXTRACTERROR=This file could not be extracted and cannot be played.
L_INSTDIRPROMPT=Please enter the drive and directory where you would like this program to be installed. To accept the default drive and directory, simply press Enter.
L_INSTFOLDERPROMPT=Do you wish to create a program folder?
L_INSTRUNPROMPT=Do you want to run
L_INSTDISKPROMPT=Please insert disk #
L_INSTDISKERROR=That's not the correct disk, try again.
L_INSTGENERROR=The installation has terminated.
L_INSTEXITPROMPT=Do you really want to cancel the installation?
L_INSTWINTITLE=Setup
L_INSTPROGTITLE=Extracting Files...
L_SENDEMAIL=Sending Mail...
L_MAILSERVER=Please enter the name of your outgoing email server:
L_COPY=Copy to Clipboard
L_SELECTALL=Select All
L_DONWLOADFILE=Downloading: %s
L_PLEASEWAIT=Please wait...
TrayMenuBegin
MenuName=TrayOpen
MenuText=Open
MenuState=3
MenuKey=0
MenuAction=SetVar "[WindowState]" "Normal"
MenuName=TrayExit
MenuText=Exit
MenuState=3
MenuKey=0
MenuAction=Exit "" ""
MenuEnd
MasterPage
NewPage=New Page
PageStyle=0
PageColor=16777215
PageGradient1=16711680
PageGradient2=255
PageGradientDir=1
WallpaperStyle=0
ObjectType=9
Name=TextEntry3
X=30
Y=75
W=262
H=127
Anchor=0
VarName=[TextEntry3]
EditMultiLine=Yes
EditLen=0
LineColor=0
LineWidth=1
LineStyle=0
FillColor=16777215
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=2
ObjectType=3
Name=PushButton1
X=327
Y=82
W=95
H=35
Anchor=0
Text=change to tag
Align=2
ImageStyle=0
ObjAction=SendKeys "" "{CtrlDn}x{CtrlDn}"¶SendKeys "" "<[tag]>{CtrlDn}v{CtrlUp}</[tag]>"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=3
ObjectType=10
Name=ListBox1
X=327
Y=124
W=94
H=103
Anchor=0
Text=html¶head¶meta¶body¶div¶p¶
VarName=[ListBox1]
VarType=0
ObjAction=SetVar "[tag]" "[ListBox1]"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=16777215
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=4
Horst Helfen

Programmers don't die, they just GOSUB without RETURN.
User avatar
Horst Helfen
 
Posts: 100
Joined: Thu May 05, 2005 4:11 am
Location: Hamburg, Germany

Postby Karrenjm » Wed Nov 25, 2009 11:25 pm

Horst Helfen wrote:The easiest way for me is to cut the hihglihgted text, write the opening tag, paste the cut text and write the end tag.
I quickly set up a little pub that basically provides this ability.
You have a text entry to put some code in. Select some text, choose the kind of tag you want and press the button.


Code: Select all
NBW Publication Source File
(C)1993-2008 NeoSoft Corp.
Title=Untitled NeoBook Publication
Language=US
NeoBookVer=5[url=http://yoogadgets.com],[/url]60
ScreenColors=16777216
ScreenWidth=640
ScreenHeight=480
BkndColor=0
ScreenAutoSize=Yes
LinkColor=16711680
WindowStyle=0
WindowOrder=0
WindowPos=0
WindowProps=31
BiDiMode=0
UseUpdateTimer=Yes
ReturnTime=60
ShapeTransColor=536870912
CompileType=0
MediaType=0
FilesIncluded=1
FontsIncluded=2
CopyExternalFiles=No
SetupMedia=3
SetupInstDir=C:\MyProgram
SetupTitle=Setup
SetupColors=16711680|0|65535
Variables=[ListBox1]¶[TextEntry3]¶
VersionMajor=1
VersionMinor=0
VersionRelease=0
VersionBuild=0
CustomFontName=Arial
CustomFontSize=9
CustomFontStyle=0
CustomCharset=1
CacheSize=30
ExtractOp=132
L_OK=OK
L_CANCEL=Cancel
L_YES=Yes
L_NO=No
L_CLOSE=Close
L_ERRORTITLE=Error
L_FINDTITLE=Find
L_FINDPROMPT=Find &What
L_FINDFIRST=&Find First
L_FINDNEXT=Find &Next
L_FINDERROR=Search text not found.
L_PWORDTITLE=Password required
L_PWORDMSG=Before continuing, you must first|enter the correct password.
L_PWORDPROMPT=&Password:
L_PWORDERROR=That's not the right password!
L_MEDIAERROR=In order to play this type of file you must install|the appropriate multimedia hardware and/or|software.
L_INTERNETERROR=Unable to locate Internet Browser software.
L_ABORTFUNCTION=Do you want to cancel this function?
L_EXTRACTERROR=This file could not be extracted and cannot be played.
L_INSTDIRPROMPT=Please enter the drive and directory where you would like this program to be installed. To accept the default drive and directory, simply press Enter.
L_INSTFOLDERPROMPT=Do you wish to create a program folder?
L_INSTRUNPROMPT=Do you want to run
L_INSTDISKPROMPT=Please insert disk #
L_INSTDISKERROR=That's not the correct disk, try again.
L_INSTGENERROR=The installation has terminated.
L_INSTEXITPROMPT=Do you really want to cancel the installation?
L_INSTWINTITLE=Setup
L_INSTPROGTITLE=Extracting Files...
L_SENDEMAIL=Sending Mail..[url=http://picslider.com].[/url]
L_MAILSERVER=Please enter the name of your outgoing email server:
L_COPY=Copy to Clipboard
L_SELECTALL=Select All
L_DONWLOADFILE=Downloading: %s
L_PLEASEWAIT=Please wait...
TrayMenuBegin
MenuName=TrayOpen
MenuText=Open
MenuState=3
MenuKey=0
MenuAction=SetVar "[WindowState]" "Normal"
MenuName=TrayExit
MenuText=Exit
MenuState=3
MenuKey=0
MenuAction=Exit "" ""
MenuEnd
MasterPage
NewPage=New Page
PageStyle=0
PageColor=16777215
PageGradient1=16711680
PageGradient2=255
PageGradientDir=1
WallpaperStyle=0
ObjectType=9
Name=TextEntry3
X=30
Y=75
W=262
H=127
Anchor=0
VarName=[TextEntry3]
EditMultiLine=Yes
EditLen=0
LineColor=0
LineWidth=1
LineStyle=0
FillColor=16777215
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=2
ObjectType=3
Name=PushButton1
X=327
Y=82
W=95
H=35
Anchor=0
Text=change to tag
Align=2
ImageStyle=0
ObjAction=SendKeys "" "{CtrlDn}x{CtrlDn}"¶SendKeys "" "<[tag]>{CtrlDn}v{CtrlUp}</[tag]>"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=3
ObjectType=10
Name=ListBox1
X=327
Y=124
W=94
H=103
Anchor=0
Text=html¶head¶meta¶body¶div¶p¶
VarName=[ListBox1]
VarType=0
ObjAction=SetVar "[tag]" "[ListBox1]"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=16777215
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=4


yeah, that's the easy way but, that's a long version. Image
Boost your download speed with http://BittorrentBooster.com
Add emotions to your text message using http://SmileysToolbar.net
Karrenjm
 
Posts: 5
Joined: Tue May 05, 2009 10:34 pm


Return to NeoBook Suggestions

Who is online

Users browsing this forum: No registered users and 1 guest

cron