problem [message #51039] |
Tue, 31 October 2006 08:34  |
taejon
Messages: 8 Registered: November 2006
|
Junior Member |
|
|
I have a problem of running this program (I am newbie in IDL...:
When I run this prog (compiles OK) it should when I press the
'dismis'-button remove the value in the textfield named 'a0'. But I get
always the error:
"pointer type required in this context"
can somebody give some help ?
regards
taejon
;*********************************************************** *******************************
pro efgcalc1_event, event
widget_control, event.id, Get_Value = buttonValue
print, buttonvalue
case buttonValue of
'QuitSofort' : widget_control, event.top, /destroy
'OPTIONS' : efgcalc1_options_events, event
'Load Binaryfile' : LoadBinFile_events, event
'Dismis' : dismisdata_event, event
'Apply' : Applydataevent, event
endcase
print, *pstate.ccaid
end
;*********************************************************** ********************************
pro applydata_event, event
print, 'Data applied'
end
;*********************************************************** ********************************
pro LoadBinFile_events, event
; Hier kann User die von EVOX bereitgestellte Datei auswaehlen !
inputfile = DIALOG_PICKFILE(/READ, FILTER="*.bin")
; Falls keine Datei ausgewaehlt wurde...
if (inputfile eq '') then begin $
widget_control, event.top, SET_UVALUE=sState, /No_Copy
RETURN
endif
widget_control, (*pstate).VoxelzahlId, get_value = VoxelzahlId
print, "Voxelzahl", (*pstate).voxelzahlId
end
;*********************************************************** ********************************
pro efgcalc1
; Hauptprogramm, hier wird die graphische Oberfläche gebastelt
; Zuerst das Menue oben (File und Options), durch Menu=1 wird 'File' zu
einem pulldown-menue
; Mit Menu = 1 wird Button zu Pulldownmenu
BaseId = widget_base(/row, title=' EFG-Berechnung',
mbar=menubaseId)
FileId = widget_button(menubaseId, Value = 'File', Menu =
1)
OptionsId = widget_button(menubaseId, Value = 'Options', Menu
= 1)
Q_Id = widget_button(menubaseId, Value = 'Quit', Menu=1)
; Hier unter dem 'File_Button', Event_pro gibt den Eventhandler an
BinaryfileId = widget_button(fileId, Value = 'Load
Binaryfile', Event_Pro=efgcalc1_LoadBinFile_events)
AsciifileId = widget_button(fileId, Value = 'Load
Asciifile')
CoreBinfileId = widget_button(fileId, Value = 'Load Binary
Corefile')
CoreAsciifileId = widget_button(fileId, Value = 'Load Ascii
Corefile')
; Hier unter 'Quit-Button'
QuitId = widget_button(Q_Id, Value = 'QuitSofort')
; Hier unter dem 'Optionsbutton'
MultiselectId = widget_button(optionsId, Value = 'Multiselect')
ComputeEFGId = widget_button(optionsId, Value = 'Compute the
EFG')
DrawEFGId = widget_button(optionsId, Value = 'Draw the EFG')
SubbaseId = widget_base(baseId, /col)
; Die Gruppe zum auswaehlen von 'settings' und 'tools'
; wTabselId = CW_BGROUP(subbaseId, ['Settings', 'Tools'])
; Das Feld mit dem Titel 'Voxelzahl' (CW_Field ist fertiges Widget in
IDL), sowie Kristalldaten
VoxelzahlId = CW_Field(SubbaseId, Title = 'Voxelzahl', Value =
100, xsize =5, /Integer)
KristalllabelId = widget_label(subbaseId, Value='Kristallsystem')
ccaId = CW_Field(SubbaseId, Title = 'a0', value =
4.8195, xsize=5, /float)
ccbId = CW_Field(SubbaseId, Title = 'b0', value =
10.480, xsize=5, /float)
cccId = CW_Field(SubbaseId, Title = 'c0', value =
6.0902, xsize=5, /float)
ccalphaId = CW_Field(SubbaseId, Title = 'alpha', value =
90.0, xsize=5, /float)
ccbetaId = CW_Field(SubbaseId, Title = 'beta', value =
90.0, xsize=5, /float)
ccgammaId = CW_Field(SubbaseId, Title = 'gamma', value =
90.0, xsize=5, /float)
; Buttons zum Aufnehmen von Voxelzahl und Kristalldaten
dismisId = widget_button(subbaseId , Value = 'Dismis',
uvalue='udismis', Event_Pro=canceldata_event, xsize=30, ysize=30)
applyId = widget_button(subbaseId, Value = 'Apply',
xsize=30, ysize=30)
; Hier das Bild wo die Elektronendichte erscheinen soll
DrawbaseId = widget_base(baseId, /col)
printId = widget_base(drawbaseId, /col)
DrawId = widget_draw(printId, xsize=500, ysize=400)
; Hier die Schieberegler fuer das Rendern sowie Texteingabe der
d-Elektronenfile
renderbaseId = widget_base(printId, /row)
RenderId = widget_slider(renderbaseId, Title='render',
minimum=0, maximum=200)
rendertext = widget_text(renderbaseId, /editable, ysize=2)
renderrefresh = widget_button(renderbaseId, Value='Refresh')
; Hier dasselbe fuer das kugelsymmetrische Fc-File
rendercorebaseId = widget_base(printId, /row)
RenderCore = widget_slider(rendercorebaseId, value='render
Core data', minimum=0, maximum=200)
rendercoretext = widget_text(rendercorebaseId, /editable, ysize=2)
rendcorerefreshID = widget_button(rendercorebaseId,
Value='rendercorerefresh')
widget_control, baseId, /realize
widget_control, drawId, get_value=winvis
; Hier werden die Infos fuer IDL bereitgestellt. Konzept Siehe Fanning
S. 154
state = {winvis : winvis, voxelzahlId : voxelzahlID, ccaid : ccaId}
pstate = ptr_new(state)
; Xmanager gibt den Eventhandler an, und welches das Hauptprogramm ist
xmanager, 'efgcalc1', baseId, Event_Handler = 'efgcalc1_event'
,/no_block
end
;;********************************************************** ***************
pro dismisdata_event, event
print, 'Data canceled'
widget_control, event.id, get_uvalue=uval
print, uval
;if ptr_valid((*pstate).ccaId) then (*pstate).ccaId =
ptr_new(/allocate_heap)
(*pstate).ccaId = 0
case uval of
'udismis' : widget_control, (*pstate).ccaId, set_value='0'
endcase
end
;*********************************************************** ********************************
|
|
|
|
Re: Problem [message #80459 is a reply to message #51039] |
Fri, 15 June 2012 11:32   |
Andy Sayer
Messages: 127 Registered: February 2009
|
Senior Member |
|
|
Some examples would be:
curve = [0,1,2,3,4]
curve = 3*findgen(10)^2.0
curve = sin(findgen(100)*!pi/180.)
(or whatever values your curve wants to take)
On Thursday, June 14, 2012 9:27:07 PM UTC-4, fada...@gmail.com wrote:
> On Friday, June 15, 2012 1:32:15 AM UTC+9, Paulo Penteado wrote:
>> On Jun 14, 6:05 am, fadaei...@gmail.com wrote:
>>> for example i wrote the curve in the command line i found this message.
>>> curve
>>> % Attempt to call undefined procedure/function: 'CURVE'.
>>> % Error occurred at: $MAIN$
>>> % Execution halted at: $MAIN$
>>> I can not understand the meaning of this experession. Could you help me about this. Thank you
>>> Best, Hadi
>>
>> IDL is not Python. It only executes statements (ex:
>> "something=something_else"), procedures (ex:
>> "some_procedure,some_argument"), or commands (ex: ".continue"). If you
>> just type in the command line a variable name, it will assume you are
>> calling a procedure with that name. If you want to know about a
>> variable, you need to use some command. For instance:
>>
>> print,some_variable
>> help,some_variable
>> print,n_elements(some_variable)
>> print,size(some_variable)
>>
>> etc.
>
> Dear
> How i can define a variable in the IDL for example define CURVE. I will be appreciate to helping me. Thank you
> Best, Hadi
|
|
|
Re: Problem [message #80468 is a reply to message #51039] |
Thu, 14 June 2012 18:27   |
hadi
Messages: 33 Registered: June 2012
|
Member |
|
|
On Friday, June 15, 2012 1:32:15 AM UTC+9, Paulo Penteado wrote:
> On Jun 14, 6:05 am, fadaei...@gmail.com wrote:
>> for example i wrote the curve in the command line i found this message.
>> curve
>> % Attempt to call undefined procedure/function: 'CURVE'.
>> % Error occurred at: $MAIN$
>> % Execution halted at: $MAIN$
>> I can not understand the meaning of this experession. Could you help me about this. Thank you
>> Best, Hadi
>
> IDL is not Python. It only executes statements (ex:
> "something=something_else"), procedures (ex:
> "some_procedure,some_argument"), or commands (ex: ".continue"). If you
> just type in the command line a variable name, it will assume you are
> calling a procedure with that name. If you want to know about a
> variable, you need to use some command. For instance:
>
> print,some_variable
> help,some_variable
> print,n_elements(some_variable)
> print,size(some_variable)
>
> etc.
Dear
How i can define a variable in the IDL for example define CURVE. I will be appreciate to helping me. Thank you
Best, Hadi
|
|
|
Re: Problem [message #80471 is a reply to message #51039] |
Thu, 14 June 2012 09:32   |
penteado
Messages: 866 Registered: February 2018
|
Senior Member Administrator |
|
|
On Jun 14, 6:05 am, fadaei...@gmail.com wrote:
> for example i wrote the curve in the command line i found this message.
> curve
> % Attempt to call undefined procedure/function: 'CURVE'.
> % Error occurred at: $MAIN$
> % Execution halted at: $MAIN$
> I can not understand the meaning of this experession. Could you help me about this. Thank you
> Best, Hadi
IDL is not Python. It only executes statements (ex:
"something=something_else"), procedures (ex:
"some_procedure,some_argument"), or commands (ex: ".continue"). If you
just type in the command line a variable name, it will assume you are
calling a procedure with that name. If you want to know about a
variable, you need to use some command. For instance:
print,some_variable
help,some_variable
print,n_elements(some_variable)
print,size(some_variable)
etc.
|
|
|
Re: Problem [message #80472 is a reply to message #51039] |
Thu, 14 June 2012 07:17   |
Andy Sayer
Messages: 127 Registered: February 2009
|
Senior Member |
|
|
That error means that the code thinks that 'curve' is a function, not a variable. Check it is defined as a variable, e.g. curve=[0,1,2,3,4,5] or similar, and check how you are referring to it in your code (i.e. that you're not calling it like a procedure/function).
On Thursday, June 14, 2012 5:05:19 AM UTC-4, fada...@gmail.com wrote:
> On Wednesday, June 13, 2012 10:51:58 PM UTC+9, Andy Sayer wrote:
>> I'd check that your variable 'curve' is defined and an array. The error message suggests it is not.
>>
>> Hope this helps,
>>
>> Andy
>>
>> On Wednesday, June 13, 2012 3:59:53 AM UTC-4, hadi wrote:
>>> Dear friend
>>> I have another problem. i tried to running this command as follow as;
>>> plot, time,curve, position=[0.1,0.55,0.95,0.95]
>>> but I recieved this error.
>>> % PLOT: Expression must be an array in this context: CURVE.
>>> % Error occurred at: $MAIN$
>>> % Execution halted at: $MAIN$
>>> What is meaning? please help me. Thank you
>>> Best, Hadi
>
> Dear Andy
> for example i wrote the curve in the command line i found this message.
> curve
> % Attempt to call undefined procedure/function: 'CURVE'.
> % Error occurred at: $MAIN$
> % Execution halted at: $MAIN$
> I can not understand the meaning of this experession. Could you help me about this. Thank you
> Best, Hadi
|
|
|
Re: Problem [message #80476 is a reply to message #51039] |
Thu, 14 June 2012 02:05   |
hadi
Messages: 33 Registered: June 2012
|
Member |
|
|
On Wednesday, June 13, 2012 10:51:58 PM UTC+9, Andy Sayer wrote:
> I'd check that your variable 'curve' is defined and an array. The error message suggests it is not.
>
> Hope this helps,
>
> Andy
>
> On Wednesday, June 13, 2012 3:59:53 AM UTC-4, hadi wrote:
>> Dear friend
>> I have another problem. i tried to running this command as follow as;
>> plot, time,curve, position=[0.1,0.55,0.95,0.95]
>> but I recieved this error.
>> % PLOT: Expression must be an array in this context: CURVE.
>> % Error occurred at: $MAIN$
>> % Execution halted at: $MAIN$
>> What is meaning? please help me. Thank you
>> Best, Hadi
Dear Andy
for example i wrote the curve in the command line i found this message.
curve
% Attempt to call undefined procedure/function: 'CURVE'.
% Error occurred at: $MAIN$
% Execution halted at: $MAIN$
I can not understand the meaning of this experession. Could you help me about this. Thank you
Best, Hadi
|
|
|
Re: Problem [message #80495 is a reply to message #51039] |
Wed, 13 June 2012 06:51   |
Andy Sayer
Messages: 127 Registered: February 2009
|
Senior Member |
|
|
I'd check that your variable 'curve' is defined and an array. The error message suggests it is not.
Hope this helps,
Andy
On Wednesday, June 13, 2012 3:59:53 AM UTC-4, hadi wrote:
> Dear friend
> I have another problem. i tried to running this command as follow as;
> plot, time,curve, position=[0.1,0.55,0.95,0.95]
> but I recieved this error.
> % PLOT: Expression must be an array in this context: CURVE.
> % Error occurred at: $MAIN$
> % Execution halted at: $MAIN$
> What is meaning? please help me. Thank you
> Best, Hadi
|
|
|
Re: Problem [message #80549 is a reply to message #80459] |
Sun, 17 June 2012 17:48   |
hadi
Messages: 33 Registered: June 2012
|
Member |
|
|
On Saturday, June 16, 2012 3:32:34 AM UTC+9, Andy Sayer wrote:
> Some examples would be:
>
> curve = [0,1,2,3,4]
> curve = 3*findgen(10)^2.0
> curve = sin(findgen(100)*!pi/180.)
>
> (or whatever values your curve wants to take)
>
> On Thursday, June 14, 2012 9:27:07 PM UTC-4, fada...@gmail.com wrote:
>> On Friday, June 15, 2012 1:32:15 AM UTC+9, Paulo Penteado wrote:
>>> On Jun 14, 6:05 am, fadaei...@gmail.com wrote:
>>>> for example i wrote the curve in the command line i found this message.
>>>> curve
>>>> % Attempt to call undefined procedure/function: 'CURVE'.
>>>> % Error occurred at: $MAIN$
>>>> % Execution halted at: $MAIN$
>>>> I can not understand the meaning of this experession. Could you help me about this. Thank you
>>>> Best, Hadi
>>>
>>> IDL is not Python. It only executes statements (ex:
>>> "something=something_else"), procedures (ex:
>>> "some_procedure,some_argument"), or commands (ex: ".continue"). If you
>>> just type in the command line a variable name, it will assume you are
>>> calling a procedure with that name. If you want to know about a
>>> variable, you need to use some command. For instance:
>>>
>>> print,some_variable
>>> help,some_variable
>>> print,n_elements(some_variable)
>>> print,size(some_variable)
>>>
>>> etc.
>>
>> Dear
>> How i can define a variable in the IDL for example define CURVE. I will be appreciate to helping me. Thank you
>> Best, Hadi
Dear Andy
Thank you for your guidance.
Hadi
|
|
|
Re: problem [message #80875 is a reply to message #51039] |
Thu, 19 July 2012 06:59  |
Vincent Sarago
Messages: 34 Registered: September 2011
|
Member |
|
|
On Wednesday, July 18, 2012 10:39:16 PM UTC-4, dave poreh wrote:
> folks
> hi,
> when i open idl, it copy's 2 folders in my desktop (metadata, defult). How could i fix this, I do not like it!!!
> Cheers,
> Dave
hi Dave,
Are you using idlde ?
Those directories are created when you first launch a new workbench (from idlde).
The .metadata can't be removed because it contain's all the preferences of the used workbench.
For the "Default" normally if you erase it from the IDE it won't appear after.
if you are not using idlde you may launch idlde just to erase the "Default" dir.
Vincent
|
|
|