dcl_Control_SetTitleBarText & NewProjectKey

Started by stephan_35, June 09, 2009, 09:19:18 AM

Previous topic - Next topic

stephan_35

Hello,

I meet this kind of problem with titleBar,
I use the NewProjectKey when loading OpenDCL project, like this :

Code (autolisp) Select

; #gpe:debug:ReloadOpenDclBoxes is T
(dcl_Project_Load "boite.projet.odcl" #gpe:debug:ReloadOpenDclBoxes "GPE:LOAD:PRO")
; Load opendcl project
; Set Project key to "GPE:LOAD:PRO"
(dcl_Form_Show "GPE:LOAD:PRO" "GPE:PROJET") ; Show dalog box
(dcl_Control_SetVisible "GPE:LOAD:PRO" "GPE:PROJET""gpe:nouveau" false) ; some request
(dcl_Control_SetCaption "GPE:LOAD:PRO" "GPE:PROJET""gpe:ouvrir" "Consulter") ; some request
(dcl_Control_SetTitleBarText "GPE:LOAD:PRO" "GPE:PROJET" "oooo") ; Does not work !



Code (autolisp) Select

(dcl_Control_SetTitleBarText "GPE:LOAD:PRO" "GPE:PROJET" "oooo") ; Does not work !
(dcl_Control_SetTitleBarText GPE:LOAD:PRO_GPE:PROJET "ooo") ; good, but not my way ...


Thanks for suggest and reply.
OpenDCL 6.0.0.6 / Editor 5.1.2.3  / Vista 32 Bits
Development of  specific tools for trades in AutoLisp - php - sql

Fred Tomke

Hm, I'm really not familiar with changing projectkeys, just two thoughts:

1. Have you ever thought about using the variables instead of text keys? I worked with text keys in the old ObjectDCL and I'm turning to the variables now.

2. Have you ever tried to test without any special chars like ":" and "."? In the past we had problems with additional "." in filenames...

I do not feel competent enough to answer.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

stephan_35

Hello !

I always use "text keys", why should i use variables specially for this dcl_control ???

In fact, that's because i often use same soft for different dialog boxes, so i just have to change my text keys for each box, like this:

Code (autolisp) Select

(dcl_Control_SetTitleBarText $var1 $var2 "My title")


and change $var1 and $var2 depending of diplayed boxes !

Using "." instead ":" does not change anything !

Aborting NewProjectKey does not change anything ....  :-[  still displaying this message :
Code (autolisp) Select

(dcl_Project_Load "boite.projet.odcl")


Quote
An OpenDCL function argument processing exception has occured !
Error: no object instance
Function : dcl_Control_SetTitleBarText
Argument : 3

Another thing :
The older command was dcl_Form_SetTitleBarText (not control) but does not work at all ! same error message !


Thanks !
OpenDCL 6.0.0.6 / Editor 5.1.2.3  / Vista 32 Bits
Development of  specific tools for trades in AutoLisp - php - sql

stephan_35

Maybe find a soluce ....

First, i think i must givup calling dcl by ascii value like "project" "box" !

I create a function for translate ascii value to entity name

Code (autolisp) Select

(defun @dcl_Project ( / )
(eval(read(strcat @$OpenDcl:Project "_" @$OpenDcl:Dialog)))
     )


and send value by calling function :

Code (autolisp) Select

(defun @GPE:PROJET:CHK (@$OpenDcl:Project @$OpenDcl:Dialog / )
    ***
    ***
    ***
       (dcl_Control_SetTitleBarText (@dcl_Project) "Title")
       (dcl_Control_SetCaption (@dcl_Project) "Label_1" "Comment :")
       (dcl_PictureBox_LoadPictureFile (@dcl_Project) "PictureBox" "mylogo.jpg")
)


and call it like this :

Code (autolisp) Select

(@GPE:PROJET:CHK "MYF:DIAL1" "BOX1")


thanks.
OpenDCL 6.0.0.6 / Editor 5.1.2.3  / Vista 32 Bits
Development of  specific tools for trades in AutoLisp - php - sql

owenwengerd

I have fixed the code for Beta 6 so that it recognizes that the third string is not the control name when calling e.g. (dcl_Control_SetTitleBarText "GPE:LOAD:PRO" "GPE:PROJET" "oooo") and no control with the name "oooo" exists in the specified form. Using the VarName lisp symbols is much more efficient and less error prone, and I recommend changing your code in any case.

Fred Tomke

stephan_35,

I know that using string may offer advantages. As I already mentioned, in further times I used string keys, too. Later I had the feeling that using the VarNames the access to controls is much faster, but that may be only my experience.

As you noted, converting strings to symbols is a solution. When converting my old ObjectDCL code to OpenDCL I created the same as you:

Code (autolisp) Select
(defun control (strC) (eval (read (strcat "signothek_" strForm "_" strC)))) ;; as local function
(defun visible (strC) (dcl_Control_SetVisible (control strC) T))


And later in the code I do:

Code (autolisp) Select

(if (isUserUsesFlyingForm)
  (setq strForm "PaletteCatalog")
  (setq strForm "ModalCatalog")
); if
[...]
(mapcar 'visible '("pb_einz" "pb_lin" "pb_flac"))


Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

stephan_35

#6
@Fred Tomke

Thanks for your examples, i miss something with my example, like sending variable throw functions not working and change it yesterday night like yours ...   ;)

Code (autolisp) Select

(defun @dcl_ ( @&liste / @$tmp )
     (foreach $tmp @&liste
  (if @$tmp
      (setq @$tmp (strcat @$tmp "_" (eval $tmp)))
      (setq @$tmp (eval $tmp))
      )
  )
(eval(read @$tmp))
     )
....
(dcl_Control_GetText (@dcl_ '( @$Dcl:P @$Dcl:D "dcl_controle")))


Anyway, thanks a lot for your help !!!


@owenwengerd

Thanks for your reply, but am i alone using this kind of calling method  ???
Because error maybe appear between V4x and V5x ...
Should be better for you to give up this one (calling with string).

Any way, i use now default varnames !
OpenDCL 6.0.0.6 / Editor 5.1.2.3  / Vista 32 Bits
Development of  specific tools for trades in AutoLisp - php - sql

owenwengerd

Strings are still supported mainly for backward compatibility. Since all the samples use symbols, I imagine that most recent OpenDCL users don't even know that it's possible to use strings.