Inserting a Value into IDE

Just starting out? Need help? Post your questions and find answers here.
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Inserting a Value into IDE

Post by Rook Zimbabwe »

OKso I am almost finished with the ColorPicker and thanks to everyone that has helped me...

The one thing I cannot seem to do is to get my program to insert the values into the IDE like the colorpicker tool does...

I thought that the IDE colorpicked might be running as some sort fo DLL and so I included DLL routines in my program...

I use the following but there is no output:

Code: Select all

ProcedureDLL.s OutRGB(red$,grn$,blu$)
groplng$ = "RGB("+red$+","+grn$+","+blu$+")"
Debug "OUT: "+groplng$
ProcedureReturn groplng$

EndProcedure
All variables are global.

What am I not doing right? :cry:
Last edited by Rook Zimbabwe on Thu Jan 03, 2008 8:44 pm, edited 2 times in total.
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
citystate
Enthusiast
Enthusiast
Posts: 638
Joined: Sun Feb 12, 2006 10:06 pm

Post by citystate »

can DLLs return a string?
have you tried returning the pointer to the string?
there is no sig, only zuul (and the following disclaimer)

WARNING: may be talking out of his hat
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

The way to accomplish this is to compile your program to an .exe and install it into the IDE using "Tools->Configure Tools". All you have to fill in for fields is the first one, "Commandline:" where you will put the path to your exe, "Name" which will be whatever you like, and "Event" which you should choose "Menu or Shortcut". Here's a sample code that works here, you will want to replace ColorRequester() with your custom color picker:

Code: Select all

result = ColorRequester()
insert$ = "RGB("+Str(Red(result))+","+Str(Green(result))+","+Str(Blue(result))+")"
scintilla = Val(GetEnvironmentVariable("PB_Tool_Scintilla"))
SendMessage_(scintilla, #EM_REPLACESEL, 0, @insert$)
Once you've done this you can click your tool from the tools menu and it will let you select a color, then place "RGB(0,0,0)" into your IDE at the cursor position. (assuming you chose black)
Last edited by netmaestro on Thu Jan 03, 2008 12:34 am, edited 1 time in total.
BERESHEIT
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Post by eddy »

I have the same problem... :?

We have all to do it :
- scintilla gadget's handle : PB_TOOL_Scintilla
- sendmessage_() with this command #SCI_INSERTTEXT

But an external tool can't send string buffer easily to an other app. :(
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Post by eddy »

netmaestro wrote:The way to accomplish this is to compile your program to an .exe and install it into the IDE using "Tools->Configure Tools". All you have to fill in for fields is the first one, "Commandline:" where you will put the path to your exe, "Name" which will be whatever you like, and "Event" which you should choose "Menu or Shortcut". Here's a sample code that works here, you will want to replace ColorRequester() with your custom color picker:

Code: Select all

result = ColorRequester()
insert$ = "RGB("+Str(Red(result))+","+Str(Green(result))+","+Str(Blue(result))+")"
scintilla = Val(GetEnvironmentVariable("PB_Tool_Scintilla"))
SendMessage_(scintilla, #EM_REPLACESEL, 0, @insert$)
why can't we use scintilla commands SCI_* ?
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

why can't we use scintilla commands SCI_* ?
Eddy, I don't know! I tried, and got the same problem as you did, so I switched to a Windows message. Seems like it should work though.
BERESHEIT
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Post by Rook Zimbabwe »

Well it inserts a color... It inserts WHITE (RGB(255,255,255) and will NOT let me choose any other color...

In fact... no matter what I pick the insert button is white and the rgb code is 255, 155, 255....

Off the IDE this works fine.

Will try as standalone... Standalone... Hmmm... If I create EXE in the same directory... it does what is is supposed to do in returning the color to the insert button.

But no output.

As I add it to my tools... output only white???

nope... works from IDE when run but NOT from IDE when called as a TOOL... that is when it returns WHITE

{{UPDATE}}
When I run this tool on its OWN sourcecode it works...

When I run it on ANYTHING ELSE... White is the order of the day...

Is my computer predudiced???

{{UPDATE AGAIN}}

It was a simple PEBKC Error - Reinforced by ID10t Variables!!! I did not Set the working directory in the tools section... I thought the images would be loaded into the program itself when compiled. Have to rethink.
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Post by Rook Zimbabwe »

Not so simple.

It has to do with how you load the images into the Image Gadget and tell the mouse what to draw.

to start with:

Code: Select all

Global Image1, Image2, Image3


Image1= CatchImage(#Image_1, ?Image1)
Image2= CatchImage(#Image_2, ?Image2)
Image3= CatchImage(#Image_3, ?Image3)

DataSection
Image1:
  IncludeBinary "colormap1.jpg"
Image2:
  IncludeBinary "greyscale.jpg"
Image3:
  IncludeBinary "plopscale.jpg"
EndDataSection
Does load the images into the program for use... Yay!!!

I modified the BOLD portion so as NOT to confuse the Image Gadget
Image1= CatchImage(#Image_1, ?Image1) where it had been #PB_Any which was misleading the program and is what my image never showed up or returned only WHITE

then I modified the Image Gadget a bit:

Code: Select all

ImageGadget(#Image_1, 6, 12, 597, 523, ImageID(#Image_1), #PB_Image_Border | #PB_EventType_LeftClick)
      RegisterGadgetEvent(#Image_1, @Image_1_Event()) 
theline:
ImageGadget(#Image_1, 6, 12, 597, 523, ImageID(#Image_1),
Had:
Image1 in that spot. So it was agreement that was thunking this apart... Though I do not see whay that wuld not have worked since they referenced the same thing???

I did not need the LoadImage() commands since the program already had them in memory because of Catchimage()

Oh well on to the finish! 8)

Thank everyone for helping me. I know I am slow.
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
Post Reply