AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

has anyone ever made a window a user can edit data in?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Sat Jan 12, 2008 5:08 pm    Post subject: has anyone ever made a window a user can edit data in? Reply with quote

For several days I've only been getting very vague replies, so let's make this as broad as possible.

Has anyone ever a made window of ANY kind in AHK in which user can edit data of ANY kind. What's the code for a window like that?
Back to top
Tuncay



Joined: 07 Nov 2006
Posts: 384
Location: Berlin

PostPosted: Sat Jan 12, 2008 5:15 pm    Post subject: Reply with quote

From the documentation...
Code:
; Example: A simple input-box that asks for first name and last name:

Gui, Add, Text,, First name:
Gui, Add, Text,, Last name:
Gui, Add, Edit, vFirstName ym  ; The ym option starts a new column of controls.
Gui, Add, Edit, vLastName
Gui, Add, Button, default, OK  ; The label ButtonOK (if it exists) will be run when the button is pressed.
Gui, Show,, Simple Input Example
return  ; End of auto-execute section. The script is idle until the user does something.

GuiClose:
ButtonOK:
Gui, Submit  ; Save the input from the user to each control's associated variable.
MsgBox You entered "%FirstName% %LastName%".
ExitApp
Back to top
View user's profile Send private message Send e-mail
Guest






PostPosted: Sat Jan 12, 2008 5:37 pm    Post subject: Reply with quote

Tuncay wrote:
From the documentation...
Code:
; Example: A simple input-box that asks for first name and last name:

Gui, Add, Text,, First name:
Gui, Add, Text,, Last name:
Gui, Add, Edit, vFirstName ym  ; The ym option starts a new column of controls.
Gui, Add, Edit, vLastName
Gui, Add, Button, default, OK  ; The label ButtonOK (if it exists) will be run when the button is pressed.
Gui, Show,, Simple Input Example
return  ; End of auto-execute section. The script is idle until the user does something.

GuiClose:
ButtonOK:
Gui, Submit  ; Save the input from the user to each control's associated variable.
MsgBox You entered "%FirstName% %LastName%".
ExitApp


I've run your example, but sorry, I would like the user to be able to EDIT, not enter data.

An example of editing data is, the user sees
Cost: 500
Taxes: 100
Shipping: 80
and decides to change the cost from 500 to 600. That's just one example,
any other example of EDITING (not entering) data is also of interest to me.
Back to top
BoBoĻ
Guest





PostPosted: Sat Jan 12, 2008 5:58 pm    Post subject: Reply with quote

Quote:
I've run your example, but sorry, I would like the user to be able to EDIT, not enter data.
Well, read AHK's Help about Gui, Add, Edit and how to set a default value within the edit field. If the user should select from a set of predefined values and should be able to edit such a value, check the combobox command.
Back to top
Guest






PostPosted: Sat Jan 12, 2008 6:02 pm    Post subject: Reply with quote

BoBoĻ wrote:
Quote:
I've run your example, but sorry, I would like the user to be able to EDIT, not enter data.
Well, read AHK's Help about Gui, Add, Edit and how to set a default value within the edit field. If the user should select from a set of predefined values and should be able to edit such a value, check the combobox command.


I guess that's a solution, but when you're inputting with a default value, it doesn't feel the same as editing. For example, imagine if a spreadsheet were all input fields with default values. It sure would feel different from editing data.
Back to top
Jero3n



Joined: 19 Jan 2007
Posts: 151

PostPosted: Sat Jan 12, 2008 6:07 pm    Post subject: Reply with quote

Try GuiControl: http://www.autohotkey.com/docs/commands/GuiControl.htm
Back to top
View user's profile Send private message
DerRaphael



Joined: 23 Nov 2007
Posts: 456
Location: Heidelberg, Germany

PostPosted: Sat Jan 12, 2008 7:32 pm    Post subject: Reply with quote

from help (fileselectfile)
Code:

FileSelectFile, SelectedFile, 3, , Open a file, Text Documents (*.txt; *.doc)
if SelectedFile =
    MsgBox, The user didn't select anything.
else
    MsgBox, The user selected the following:`n%SelectedFile%

from help (gui -> add -> edit)
Code:

Gui, Add, Edit, R20 vMyEdit
FileRead, FileContents, C:\My File.txt
GuiControl,, MyEdit, %FileContents%


those two together end up like this:
Code:

FileSelectFile, SelectedFile, 3, , Open a file, Text Documents (*.txt)
if SelectedFile =
    MsgBox, The user didn't select anything.
else
{
    Gui, Add, Edit, R20 vMyEdit
    FileRead, FileContents, %SelectedFile%
    GuiControl,, MyEdit, %FileContents%
    Gui, Show
}


derRaphael
_________________
Back to top
View user's profile Send private message
Guest






PostPosted: Sat Jan 12, 2008 7:58 pm    Post subject: Reply with quote

I like it a lot. Is there any way to bring up the editing mode with a button click and have it normally be static text (like in an error message or something)

Thanks again.
Back to top
DerRaphael



Joined: 23 Nov 2007
Posts: 456
Location: Heidelberg, Germany

PostPosted: Sun Jan 13, 2008 2:32 am    Post subject: Reply with quote

Code:

FileSelectFile, SelectedFile, 3, , Open a file, Text Documents (*.txt)
if SelectedFile =
    MsgBox, The user didn't select anything.
else
{
    RO = 1
    Gui, Add, Edit, R20 +ReadOnly vMyEdit
    Gui, Add, Button, wp gtEdit, Toggle Edit
    FileRead, FileContents, %SelectedFile%
    GuiControl,, MyEdit, %FileContents%
    Gui, Show
}
return

tEdit:
  if (RO=1) {
    RO = 0
    GuiControl, -ReadOnly, MyEdit
  } else {
    RO = 1
    GuiControl, +ReadOnly, MyEdit
  } 
return


greets
derRaphael
_________________
Back to top
View user's profile Send private message
urlwolf



Joined: 16 Mar 2006
Posts: 100

PostPosted: Sun Jan 13, 2008 3:27 am    Post subject: Reply with quote

If you are after some more advanced editing (i.e., code) you may want to try HiEditor, which majkinetor has integrated. Do a forum search.

Also, I'd like to know if someone has found an easy way to do simple spreadsheet-like things. I have found this component but that's a bit too much.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group