Page 1 of 1

Code Form Helper for Windows

Posted: Thu Oct 10, 2013 12:14 am
by falsam
Code Form Helper.
If like me you prefer to code your windows manually, Code Form Helper is for you. Encode your window in your usual editor and select the code of your window. Launch Code Form Helper and finalize the design of your window in the inspector gadget.

Installation.
Add Code Form Helper in Pure Basic tools. Do not forget to assign a key or key combination shortcut to launch it from your editor.

Image

How it works ?.
Select a portion of code containing the gadgets from Pure Basic Editor.
Image

If you code from the official Pure Basic IDE or JaPBe V3 (Philippe Guntz a.k.a. gnozal), it is not necessary to make a copy in memory.
Launch Code Form Helper from the tools menu or use your key shortcut.

Image

Image Image

Hotkeys.
Use inspector gadget or :

Changing the position (Left/Right/Top/Bottom) of a gadget.
Ctrl + Up Arrow or Ctrl + Down Arrow Move gadget up or down.
Ctrl + Left Arrow or Ctrl + Right Arrow Move gadget to the left or right.

Change the size (height / width of a gadget.
Alt + Up Arrow or Ctrl + Down Arrow Edit the height of a gadget.
Alt + Left Arrow or Alt + Right Arrow Change the width of a gadget.

Escape close Code Form Helper.

How to update your code editor Pure Basic?.
Click on the Copy button to copy the code in memory. It is not necessary to select the code.

Close Code Form Helper and now go back to your editor to update the code (Ctrl + V).

Download.

:arrow: Code Form Helper Versions 0.83.zip 91 ko

If you have a problem with your antivirus, you can download the WinRar version.
:arrow: Code Form Helper Versions 0.83.rar 81 ko

Official Link to the French forum. If you have an account, try to post your comments on this link. But do not worry, I'm watching this post. :)
http://www.purebasic.fr/french/viewtopi ... =8&t=13996

My English is very bad, but I'll try to answer your comments. Thank you for your indulgence.

Re: Code Form Helper for Windows

Posted: Thu Oct 10, 2013 3:34 pm
by falsam
Code Form Helper 0.81 is out.
-Fixed some bugs.

Re: Code Form Helper for Windows

Posted: Mon Oct 14, 2013 10:52 am
by Kwai chang caine
Cool idea, thanks FALSAM 8)
Just one question, have you thinking to add a day, the possibility to move the gadget with the mouse ?

Re: Code Form Helper for Windows

Posted: Mon Oct 14, 2013 2:23 pm
by falsam
Kwaï chang caïne wrote:Cool idea, thanks FALSAM
Hello KCC. Glad to read you. Long ago that I have not spoken with you. I was wondering if anyone was interested in this tool :mrgreen: ha ha ha
Kwaï chang caïne wrote:Just one question, have you thinking to add a day, the possibility to move the gadget with the mouse ?
Why not .... but I look for a method without API. :)

Re: Code Form Helper for Windows

Posted: Tue Oct 15, 2013 7:04 pm
by Kwai chang caine
Thanks FALSAM
Me too i'm always happy to talk with you 8) in "frenglish" :oops: :lol:
Hello KCC. Glad to read you. Long ago that I have not spoken with you. I was wondering if anyone was interested in this tool ha ha ha
It's strange because it's really a good idea like numerous of your ideas :shock:
I'm sure someone come a day and see the service this tool can do :wink:

Thanks for your anwer, and again for all the great jobs you do, all the day, since we have the chance to have you in the community 8)

Re: Code Form Helper for Windows

Posted: Mon Oct 21, 2013 6:16 pm
by falsam
Code Form Helper 0.83 is out.
-Fixed some bugs.

Goto the first message and download.

Re: Code Form Helper for Windows

Posted: Sun Jan 26, 2014 4:44 pm
by Axolotl
Thanks falsam for the nice tool.

Unfortunately I usually create my code with variables as below, because of the resize window stuff....
Do you think it is possible to add some similar feature?

In CreateMainWindow()

Code: Select all

  ww = 650 : wh = 340
  hWnd = OpenWindow(#WndMain, 0, 0, ww, wh, "MainWindowCaption", #PB_Window_SizeGadget|#PB_Window_SystemMenu) 
  If hWnd ;: window exists... 
    ; ... 
    ButtonGadget(#BtnStart, ww-78, 2, 76, 20, "Start") 
    ; ... 
In ResizeMainWindow()

Code: Select all

  ; ...
  ww = WindowWidth(#WndMain) 
  wh = WindowHeight(#WndMain)-StatusBarHeight(#Status)
  ResizeGadget(#BtnStart, ww-78, #PB_Ignore, #PB_Ignore, #PB_Ignore) 
  ; ... 
Hmm. After some minutes - I believe it is the wrong question. Of course it is possible, but are you willing to do it?
Anyway. Please take this as a low priority feature request.

Take care.
Cu Andreas

Re: Code Form Helper for Windows

Posted: Mon Jan 27, 2014 12:20 am
by falsam
Hi Axoloti. Difficult to precompile the code and define the variables. I'll take a look :)

Re: Code Form Helper for Windows

Posted: Sat Mar 15, 2014 11:54 am
by Axolotl
Hi falsam,

good to hear.
In the meantime I tried to make a tool outside of PB to show the window by reading the codelines.
I use the following concept to handle this windows size stuff.

The evaluator is from utopiomania....

Code: Select all

;EvalExpr.pbi
;String math expression evaluator,  utopiomania 20070211
I encapsulated it with this

Code: Select all

Procedure.s ExpandFormulaText(Text$) 
  Protected Result$, Formula$, xFormula
  Protected *p.CHARACTER, *chCurr.CHARACTER = @Text$

  While *chCurr\c ! 0 
    Select *chCurr\c
      Case '0' To '9', '.', '-'
        If Not xFormula
          xFormula = #True
        EndIf

      Case '('           ;* valid formula start char
        *p = *chCurr + SizeOf(CHARACTER)
        If (*p\c >= '0' And *p\c <= '9') Or *p\c = '.' Or *p\c = '-'
          xFormula = #True
        EndIf

      Case ' ', '+', '*', '/', ')'     ;* valid formula char
        ;: nothing

      Default                          ;* end a formula
        If xFormula
          xFormula = #False
        EndIf

    EndSelect
    If xFormula
      Formula$ + Chr(*chCurr\c) 
    Else
      If Formula$
        Result$ + Str(MathExpression::Evaluate(Formula$))
        Formula$ = ""
      EndIf
      Result$ + Chr(*chCurr\c)         ;:Debug "  R:'"+Result$+"'"
    EndIf
    *chCurr + SizeOf(CHARACTER)
  Wend
  If Formula$
    Result$ + Str(MathExpression::Evaluate(Formula$))
  EndIf                                ;:Debug "Result = '"+Result$+"'"  :Debug ""
  ProcedureReturn Result$
EndProcedure

Procedure Formula(Text$)
  Protected value, t$, ww, wh

  If IsWindow(#WndViewGadget)
    ww = WindowWidth(#WndViewGadget) : wh = WindowHeight(#WndViewGadget)
  EndIf

  Text$ = ReplaceString(Text$, "WndW", Str(ww))
  Text$ = ReplaceString(Text$, "ww", Str(ww))
  Text$ = ReplaceString(Text$, "WndH", Str(wh))
  Text$ = ReplaceString(Text$, "wh", Str(wh))

  t$ = ExpandFormulaText(Text$)
  If t$
    value = Val(t$)  ;:Debug "Expand: "+t$
  EndIf
  ProcedureReturn value
EndProcedure
As you can see, I use the size of the preview window to replace the WndW, WndH or ww, wh variables.
Have a good time.
Andreas

Re: Code Form Helper for Windows

Posted: Sat Mar 15, 2014 4:17 pm
by falsam
Thank for your code Axolotl. I get an error when I compile your code but I understand. (Module not found : MathExpression)

Re: Code Form Helper for Windows

Posted: Sun Jan 11, 2015 11:29 am
by thanos
@falsam
I just found it! :D
it is an amazing tool for real time corrections in the gadgets.
Smart and efficient.
Congratulations!

Thanos