António,
I guess that your code should work. I basically had the same in my
working version pasted bellow. But that doesn't address my main
>>questions that i raised in previous message on what are dialogs, how
to put plots side by side, etc...I'm afraid that without understanding
those I'll be hitting my head on the wall next time I try to do
something different (well, I'm actually there >>already).
Thanks
Joaquim
using IUP
using IUP_IM
using IUP_CD
function axes()
IupOpen() #Initializes IUP
IupPlotOpen(); # init IupPlot library
# create plot
plot = IupPlot()
hbox = IupHbox(plot);
IupSetAttribute(hbox, "MARGIN", "10x10");
IupSetAttribute(hbox, "GAP", "10");
dlg = IupDialog(hbox);
IupSetAttributes(dlg, "SIZE=500x240" );
IupSetAttribute(dlg, "TITLE", "IupPlot Example");
IupSetAttribute(plot, "TITLE", "AutoScale")
IupSetAttribute(plot, "MARGINTOP", "40")
IupSetAttribute(plot, "MARGINLEFT", "40")
IupSetAttribute(plot, "MARGINBOTTOM", "50")
IupSetAttribute(plot, "TITLEFONTSIZE", "16")
IupSetAttribute(plot, "AXS_XLABEL", "gnu (Foo)")
IupSetAttribute(plot, "AXS_YLABEL", "Space (m^3)")
IupSetAttribute(plot, "AXS_YFONTSIZE", "7")
IupSetAttribute(plot, "AXS_YTICKFONTSIZE", "7")
#IupSetAttribute(plot, "LEGENDSHOW", "YES");
IupSetAttribute(plot, "AXS_XFONTSIZE", "10");
IupSetAttribute(plot, "AXS_YFONTSIZE", "10");
IupSetAttribute(plot, "AXS_XLABELCENTERED", "NO");
IupSetAttribute(plot, "AXS_YLABELCENTERED", "NO");
IupSetAttribute(plot, "AXS_XARROW", "NO");
IupSetAttribute(plot, "VIEWPORTSQUARE")
error = pointer([0])
im = imFileImageLoadBitmap("V://Capture.PNG", 0, error)
error = unsafe_load(error)
image = IupImageFromImImage(im)
#image = IupLoadImage("V://Capture.PNG")
IupSetAttributeHandle(plot, "BACKIMAGE", image)
IupSetAttribute(plot, "BACKIMAGE_XMIN", "-100");
IupSetAttribute(plot, "BACKIMAGE_XMAX", "150");
IupSetAttribute(plot, "BACKIMAGE_YMIN", "-2");
IupSetAttribute(plot, "BACKIMAGE_YMAX", "2");
IupPlotBegin(plot, 0)
IupPlotAdd(plot, -100., -2.)
IupPlotAdd(plot, 150., 2.)
IupPlotEnd(plot)
IupSetAttribute(plot, "DS_MODE", "MARK")
IupSetAttribute(plot, "DS_MARKSIZE", "1")
IupShowXY(dlg, IUP_CENTER, IUP_CENTER);
IupMainLoop()
IupClose()
return
end
I think it should be this (not sure, never programmed in Julia):
IupOpen();
IupPlotOpen(); # init IupPlot library
# create plots
plot = IupPlot()
# dialog
hbox = IupHbox(plot, C_NULL);
IupSetAttribute(hbox, "MARGIN", "4x4");
IupSetAttribute(hbox, "GAP", "10");
dlg = IupDialog(hbox);
IupSetAttributes(dlg, "SIZE=500x240" );
IupSetAttribute(dlg, "TITLE", "IupPlot Example");
InitPlots(); # It must be able to be done independent of dialog Mapping
IupShowXY(dlg, IUP_CENTER, IUP_CENTER);
IupSetAttribute(dlg, "SIZE", C_NULL);
IupMainLoop()
IupClose()
It this showing a dialog with at least a white canvas in the
center surrounded by 4x4 margins?
Best,
Scuri
On Sat, May 23, 2015 at 12:04 PM, Joaquim Luis <[email protected]>
wrote:
No, the vboxr was NULL terminated (see line: vboxr[2] = C_NULL #
mark end of vector) and I kept the vector out of pure laziness. It
>>>>turned out that this didn't work
plot = IupPlot()
dlg = IupDialog(hbox);
because I had an issue on the porting of IupPlot that returned a
pointer to int instead of a pointer to Ihandle (a void *). When I
fixed this >>>>it started to work.
But my basic incomprehension of what a dialog is still remains. I
know the doc says
"... It manages user interaction with the interface elements"
but sorry, this too vague for me. Can I think of it as a similar to
the Matlab handle to a Figure?
Why can't I create a dialog by calling it on a IupCanvas. That is,
why doesn't this work?
dlg = IupDialog( IupCanvas())
And a IupPlot object, can I think of it as a ML equivalent to an axes
handle? How can I put more than one IupPlot plot side by side?
Well, sorry. Lots of questions but I still don't understand the
"mechanics of the IUP ensemble"
Joaquim
Hi,
I think there is a misunderstanding about the vbox terminator. When
you pass a list of controls for a box you end that list with a null,
>>>>>for instance vbox(but1, but2, null).
This is not what you are doing. First, if you don't want a tabs,
remove it from your test. Make it simpler. You also don't need an
array >>>>>of plots, you will use just one. Eliminate that too.
Then we start from there.
And send me the full Julia file so I can also see what you are
doing in InitPlot.
Best,
Scuri
Em 22/05/2015 16:55, "Joaquim Luis" <[email protected]> escreveu:
Thanks,
I managed to make it work in a stripped down version of the pplot
example.But now I don't want to plot it in a Tab, I just want a
simple plot with an image. I understand that the solution must be
in what is used >>>>>>to generate the IupDialog() bellow, but
everything else that I try just brings an empty figure.
This is so painful by trial and error. I guess that I simply don't
understand what a dialog (the return of IupDialog(...)) is and the
>>>>>>importance of its input argument.
Joaquim
IupControlsOpen(); # init the addicional controls library (we use
IupTabs)
IupPlotOpen(); # init IupPlot library
# create plots
plot[1] = IupPlot()
# right panel: tabs with plots
vboxr[1] = IupVbox(plot[1]); # each plot a tab
s = @sprintf("Plot %d", 1)
IupSetAttribute(vboxr[1], "TABTITLE", s); # name each tab
vboxr[2] = C_NULL # mark end of vector
tabs = IupTabsv(pointer(vboxr)) # create tabs
# dialog
hbox = IupHbox(tabs);
IupSetAttribute(hbox, "MARGIN", "4x4");
IupSetAttribute(hbox, "GAP", "10");
dlg = IupDialog(hbox);
IupSetAttributes(dlg, "SIZE=500x240" );
IupSetAttribute(dlg, "TITLE", "IupPlot Example");
InitPlots(); # It must be able to be done independent of dialog
Mapping
IupShowXY(dlg, IUP_CENTER, IUP_CENTER);
IupSetAttribute(dlg, "SIZE", C_NULL);
IupMainLoop()
IupClose()
Hi,
No, only IupImage is accepted as an image handle in a control. So
instead of using imFileImageLoadBitmap, use IupLoadImage. It
>>>>>>>will use imFileImageLoadBitmap internally and it will
return an IupImage Ihandle* so you can use it in
IupSetAttributeHandle.
Best,
Scuri
On Wed, May 20, 2015 at 11:24 AM, Joaquim Luis <[email protected]>
wrote:
Hi,
How can I plot an image in an axes with coordinates?
I tried with IupPlot and attribute "BACKIMAGE", as in (in Julia)
error = pointer([0])
image = imFileImageLoadBitmap("V://Capture.PNG", 0, error)
IupSetAttributeHandle(plot[1], "BACKIMAGE",
convert(Ptr{Void}, image));
but get crashes from the C side saying
Exception: EXCEPTION_ACCESS_VIOLATION at 0x7ffdca48afd2 --
iupTableGet at
C:\programs\compa_libs\iup\iup.DLL (unknown line)
iupTableGet at C:\programs\compa_libs\iup\iup.DLL (unknown line)
cdIupDrawImage at C:\programs\compa_libs\iup\iupcd.dll (unknown
line)
...
Thanks
Joaquim
------------------------------------------------------------------------------
One dashboard for servers and applications across
Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable
Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Iup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/iup-users